PHP code example of hostnet / asset-lib

1. Go to this page and download the library: Download hostnet/asset-lib 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/ */

    

hostnet / asset-lib example snippets


$config = new \Hostnet\Component\Resolver\Config\SimpleConfig(
    true, // is dev
    __DIR__,
    [],
    ['app.js'],
    ['styles.less'],
    'web',
    'dist',
    'assets',
    __DIR__ . '/var',
    [
        new \Hostnet\Component\Resolver\Plugin\CorePlugin(),
        new \Hostnet\Component\Resolver\Plugin\LessPlugin(),
    ],
    new \Hostnet\Component\Resolver\Import\Nodejs\Executable('/usr/bin/node', __DIR__ . '/node_modules/')
);

$packer = new \Hostnet\Component\Resolver\Packer();
$packer->pack($config);


use Hostnet\Component\Resolver\Plugin\PluginApi;
use Hostnet\Component\Resolver\Plugin\PluginInterface;

class MyPlugin implements PluginInterface
{
    public function activate(PluginApi $plugin_api): void
    {
        // $plugin_api->addBuildStep(new MyBuildStep());
        // $plugin_api->addCollector(new MyCollector());
        // $plugin_api->addWriter(new MyWriter());
    }
}