1. Go to this page and download the library: Download jasny/assetic-extensions 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/ */
jasny / assetic-extensions example snippets
use Assetic\Factory\AssetFactory;
use Jasny\Assetic\AssetCacheWorker;
$factory = new AssetFactory('/path/to/asset/directory/');
$factory->setAssetManager($am);
$factory->setFilterManager($fm);
$factory->addWorker(new AssetCacheWorker(
new FilesystemCache('/path/to/cache')
));
use Assetic\Factory\AssetFactory;
use Jasny\Assetic\AssetVersionWorker;
$factory = new AssetFactory('/path/to/asset/directory/');
$factory->setAssetManager($am);
$factory->setFilterManager($fm);
$factory->addWorker(new AssetVersionWorker($version));
use Jasny\Assetic\PersistentAssetWriter;
use Jasny\Assetic\TwigCachingFormulaLoader;
use Assetic\Extension\Twig\TwigResource;
use Assetic\Factory\LazyAssetManager;
$twigLoader = new Twig_Loader_Filesystem('/path/to/views');
$twig = new Twig_Environment($twigLoader, ['cache' => '/path/to/cache', 'auto_reload' => true]);
$am = new LazyAssetManager($factory);
// enable loading assets from twig templates, caching the formulae
$am->setLoader('twig', new TwigCachingFormulaLoader($twig));
// loop through all your templates
foreach ($templates as $template) {
$resource = new TwigResource($twigLoader, $template);
$am->addResource($resource, 'twig');
}
$writer = new PersistentAssetWriter('/path/to/web');
$writer->writeManagerAssets($am);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.