gmodstore/php-gmad

package / unpackage garry's mod gma files

1.1.0 2018-04-22 11:37 UTC

This package is not auto-updated.

Last update: 2024-04-14 19:56:29 UTC


README

PHP Garry's Mod Addon Library (php-gmad) is a PHP library for handling and manipulation of Garry's Mod addon files (.gmad). These files provide a description of the addon and a filesystem of the addon, both can be managed using this library.

Latest Version Issues Open License

Requirements

  • PHP >=7.1 (64 bit)
  • mdurrant/php-binary-reader

Code Examples

$gma_data = fopen(__DIR__ . '/gmas/test.gma', 'rb');

$reader = new AddonReader($gma_data);
$reader->parse(); // throws

$addon = $reader->getAddon();

echo $addon . PHP_EOL;
echo count($addon->getFileIndex()) . ' file(s): ' . PHP_EOL;

foreach ($addon->getFileIndex() as $file) {
    echo "\t" . $file->getFileNumber() . '. ' . $file->getPath() . ' @ ' . $file->getOffset() . ' : ' . $file->getSize() . ' bytes' . PHP_EOL;
}

License

php-gmad is licensed under the MIT License.

Copyright 2018 Matt Stevens