mvanvu/php-assets

This package is abandoned and no longer maintained. No replacement package was suggested.

Php Assets Manager package

1.0 2020-12-03 02:14 UTC

This package is auto-updated.

Last update: 2021-02-27 09:42:04 UTC


README

Deprecated

Since the Php-form version 1.0.1 has removed the php-assets | Don't use this anymore

Php Assets Manager package

{
	"require": {
		"mvanvu/php-assets": "~1.0"
	}
}

Alternatively, from the command line:

composer require mvanvu/php-assets

About

  • Using while you're handling Php and want to dynamic adding the css/js assets contents
  • Auto minifies the assets contents (Thanks to matthiasmullie/minify)

Usage

use MaiVu\Php\Assets;

// Add assets
Assets::addFile('path/to/file.css');
Assets::addFile('path/to/file.js');


// OR
Assets::addFiles(
    [
        'path/to/file.css',
        'path/to/file.js',
    ]
);

// Inline assets
Assets::inlineCss('body {margin: 0; padding: 0}');
Assets::inlineJs('alert("It works")');

// Compress assets
Assets::compress();

// Render Header
echo Assets::output('css');
echo Assets::output('inlineCss');
echo Assets::output('js');
echo Assets::output('inlineJs');