PHP code example of mtymek / class-dumper
1. Go to this page and download the library: Download mtymek/class-dumper 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/ */
mtymek / class-dumper example snippets
// config/classes-to-cache.php
return [
// ZF2 classes
Zend\Mvc\Application::class,
Zend\Mvc\ApplicationInterface::class,
Zend\EventManager\EventsCapableInterface::class,
// custom classes
Foo\Application::class,
Foo\Listener\Auth::class
]
// index.php
a/cache/classes.php.cache';
$dumper = new ClassDumper();
$cache = $dumper->dump([
Foo::class,
Bar::class,
]);
file_put_contents('data/cache/class_cache', "\n" . $cache);
$cache = $dumper->dump([ /* ... */ ], true);
$configGenerator = new \ClassDumper\ConfigGenerator;
$configGenerator->dumpIncludedClasses('config.php');
bash
php ./vendor/bin/dump-classes.php config/classes-to-cache.php data/cache/classes.php.cache
json
{
"scripts": {
"post-install-cmd": [
"php ./vendor/bin/dump-classes.php config/classes-to-cache.php data/cache/classes.php.cache-raw",
],
"post-update-cmd": [
"php ./vendor/bin/dump-classes.php config/classes-to-cache.php data/cache/classes.php.cache-raw",
]
}
}
bash
php ./vendor/bin/dump-classes.php config/classes-to-cache.php classes.php.cache --strip