1. Go to this page and download the library: Download chaostangent/php-ass 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/ */
chaostangent / php-ass example snippets
use ChaosTangent\ASS\Reader;
$reader = new Reader();
$script = $reader->fromFile(__DIR__.'/examples/example.ass');
foreach ($script as $block) {
echo $block->getId().PHP_EOL;
foreach ($block as $line) {
echo $line->getKey().': '.$line->getValue();
}
}
$script = new Script('[Script Info]', 'mytestscript.ass');
if ($script->isASSScript()) {
// do more processing
}
$script->parse();
foreach ($script as $block) {
// block processing
}
if ($script->hasBlock('Script Info')) {
$script->getBlock('Script Info');
}