PHP code example of serebro / assets-manager
1. Go to this page and download the library: Download serebro/assets-manager 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/ */
serebro / assets-manager example snippets
$env = 'prod';
$revisionMap = json_decode(file_get_contents('build/manifest.json'), true); // { "file1.js": "file2-73a4818b.min.js", "file2.js": "file2-54e1080b.min.js" }
$ar = new \Serebro\Assets\Revision($env);
$ar->setRevisionMap($revisionMap)->setPrefix('http://cdn.example.com');
$assetsManager = \Serebro\Assets\Manager::getInstance();
$assetsManager
->setRevisionManager($ar)
->collection('head')
->addCss('main.css')
->addJs('file1.js')
->collection('body')
->addCss('special.css')
->addJs('file2.js');
echo $assetsManager->outputCss('head') . PHP_EOL;
echo $assetsManager->outputJs('head') . PHP_EOL;
echo $assetsManager->outputCss('body') . PHP_EOL;
echo $assetsManager->outputJs('body') . PHP_EOL;