shineunited / silex-assets
2.0.0
2017-05-17 20:43 UTC
Requires
- php: >=5.5.9
- silex/silex: ^2.0
Requires (Dev)
- phpunit/phpunit: ~4.0|~5.0
- symfony/browser-kit: ~3.0
- twig/twig: ^1.33
Suggests
- twig/twig: Allow use of asset manager inside of twig templates
This package is auto-updated.
Last update: 2024-11-15 01:51:35 UTC
README
A Silex package for managing local and remote static assets.
Installation
The recommended way to install silex-assets is through composer:
$ composer require shineunited/silex-assets
Configuration
require_once(__DIR__ . '/../vendor.autoload.php'); use Silex\Application; use ShineUnited\Silex\Assets\AssetManagerServiceProvider; $app->register(new AssetManagerServiceProvider(), [ 'assets.path' => '/path/to/assets/' ]);
Usage
Accessing prefixed assets
echo $app['assets']->lookup('my/asset.txt'); // returns: /path/to/assets/my/asset.txt
Mapping additional assets
$app['assets']->map('jquery.js', 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'); echo $app['assets']->lookup('jquery.js'); // returns: https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js