PHP code example of bvanhoekelen / php-compressor

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

    

bvanhoekelen / php-compressor example snippets


    (Input)                                                           (Output)
    
Root/                                           .               Root/
└── Resources/             .. ..................;;.             └── Public/ (!)
    └── css/ (!)              .. PHP compresspr ;;;;.               └── compressor/ (static)
    │   ├── table.css    . . .::::::::::::::::::;;:'                   ├── take.css
    │   ├── alert.css                           :'                     └── take.js
    │   ├── button.css
    │   ...
    └── js/  (!)
    │   ├── table.js
    │   ├── alert.js
    │   ├── button.js
    │   ...
    ..

                             (PHP compressor)
 
 PhpCompressor::run(['resources/assets/css/', 'resources/assets/js/'], 'public/');
 PhpCompressor::run( [ <loccation> , <location>, ... ], <destination> ); // explanation!
    

// Add namespace at the top
use PhpCompressor\PhpCompressor;

// Place the code in the `public function boot()`.
if(config('app.debug')) // DON'T USE ON PRODUCTION !!
    PhpCompressor::run(['resources/assets/css/', 'resources/assets/js/'], 'public/');

// Require vender autoload
ompressor\PhpCompressor;

// Switch which determines if environment is production
$production = false;

// Run php conpressor
if( ! $production ) // DON'T USE ON PRODUCTION !!
    PhpCompressor::run(['resources/css/', 'resources/js/'], 'public/');
{r, engine='bash', count_lines}
 $ composer 
{r, engine='bash', count_lines}
 $ composer