michaeljdennis / phasset
A simple PHP asset library.
1.1.0
2015-12-11 09:14 UTC
Requires
- php: >=5.4.0
This package is auto-updated.
Last update: 2025-03-29 00:26:06 UTC
README
A simple PHP asset library.
Usage
Installation with Composer
composer require michaeljdennis/phasset
Queue up styles and scripts
use Phasset\Phasset;
$phasset = new Phasset();
$phasset->add('reset.css');
$phasset->add('styles.css');
$phasset->add('scripts.js');
Output link and script tags in a view file
$phasset->css();
// <link media="all" type="text/css" rel="stylesheet" href="reset.css">
// <link media="all" type="text/css" rel="stylesheet" href="styles.css">
$phasset->js();
// <script src="scripts.js"></script>
Laravel
Configuration for Laravel < 5.5
Add service provider to the providers
array in /config/app.php
.
Phasset\PhassetServiceProvider::class,
Add facade to the facades
array in /config/app.php
.
'Phasset' => Phasset\Facades\Laravel\Phasset::class,
Usage
Use facade to access methods.
Phasset::add('reset.css');
Phasset::add('styles.css');
Phasset::add('scripts.js');
Phasset::css();
Phasset::js();
To Do
- PSR-4 autoloading.