Recommended Posts

Hi guys,

I'm here to share with you my new project php-grf, with this guy you can use PHP to read and write grf files.

  • This only supports grf files with version 0x200;
  • This supports read and writing in grf files;

This code is based on

The code ahead will show you how to extract all files inside grf.

require_once 'php-grf/lib/autoload.php';

// Instance a reader/writer for your grf file
$grf = new GrfFile('php-grf/tests/test200.grf');

foreach ($grf->getEntries() as $entry) {
    $dir = dirname($entry->getFilename());

    if (is_dir($dir) === false)
        mkdir ($dir, 0777, true);

    $file = str_replace('\\', '/', $entry->getFilename());
    $buffer = $entry->getUnCompressedBuffer();

    $fp = fopen($file, 'wb');
    fwrite($fp, $buffer);

// Dispose all resources used
$grf = null;


Enjoy it, has any issue or problem with the lib? Please report it and help to keep it good for you all use.

Repo URL:


Other useful repositories: (Read-only C#) (Read-Write C)

Edited by CarlosHLFZ
  • Upvote 3

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.