shineunited/silex-assets

2.0.0 2017-05-17 20:43 UTC

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.

Latest Stable Version Minimum PHP Version Build Status

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