PHP code example of gmodstore / php-gmad

1. Go to this page and download the library: Download gmodstore/php-gmad library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gmodstore / php-gmad example snippets


$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;
}