PHP code example of it-for-free / php-simple-assets

1. Go to this page and download the library: Download it-for-free/php-simple-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/ */

    

it-for-free / php-simple-assets example snippets


\ItForFree\SimpleAsset\SimpleAssetManager::$assetsPath = 'myassets/'; // default 'assets/'


namespace application\models;
use ItForFree\SimpleAsset\SimpleAsset;

/**
 *  TestAsset -- пример описания пакета ресурсов (ассета)
 *
 * @author vedro-compota
 */
class BaseAsset extends SimpleAsset
{
    public $basePath = 'JS/'; // from doc root
    public $js = [
        'myjs/basejs.js' // relative from $basePath path
    ];
    
    public $css = [
        'myjs/css/basecss.css' // relative from $basePath path
    ];
}

use ItForFree\SimpleAsset\SimpleAsset;
use application\models\BaseAsset;

/**
 *  TestAsset -- пример описания пакета ресурсов (ассета)
 *
 * @author vedro-compota
 */
class TestAsset extends SimpleAsset
{
    public $basePath = 'JS/';
    public $js = [
        'myjs/test1.js',
        'myjs/test2222.js'
    ];
    
    public $css = [
        'myjs/css/my.css'
    ];
    
    public $needs = [BaseAsset::class];
}