PHP code example of mvanvu / php-assets

1. Go to this page and download the library: Download mvanvu/php-assets 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/ */

    

mvanvu / php-assets example snippets

 php
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');