PHP code example of wbadrh / phpackage-json

1. Go to this page and download the library: Download wbadrh/phpackage-json 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/ */

    

wbadrh / phpackage-json example snippets




$assets = new PHPackage(
    __DIR__ . '/../package.json',  // yarn package
    __DIR__ . '/../node_modules/', // yarn vendor
    [
        // custom css
        __DIR__ . '/src/css/*'     // user stylesheets
    ],
    [
        // custom js
        __DIR__ . '/src/js/*'      // user javascript
    ],
    [
        // exclude
        'index.js',
    ]
);

$assets->fonts(__DIR__ . '/fonts');
html
<link href="<?= $assets->css(__DIR__, '/css/bundle.min.css') 
html
<script src="<?= $assets->js(__DIR__, '/js/bundle.min.js')