PHP code example of deliverist / builder

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

    

deliverist / builder example snippets

 php


use Deliverist\Builder\Builder;
use Deliverist\Builder\Commands;
use Deliverist\Builder\Loggers;

$builder = new Builder('/path/to/source/code', [
	'composer-install' => new Commands\ComposerInstall,
	'rename' => new Commands\Rename,
	'remove' => new Commands\Remove,
], new Loggers\TextLogger);

$builder->make('composer-install')
	->make('rename', ['from' => 'index.php', 'to' => 'www/index.php'])
	->make('remove', ['file' => 'composer.lock'])
	->make('composer-install');

 php
$builder->make('apache-imports', ['file' => 'file-to-expand.txt']);
$builder->make('apache-imports', ['files' => [
	'admin.js',
	'front.js',
]]);
 php
$builder->make('composer-install');
$builder->make('composer-install', ['composerFile' => 'path/to/composer.json']);
 php
$builder->make('css-expand-imports', ['file' => 'file-to-expand.txt']);
$builder->make('css-expand-imports', ['files' => [
	'admin.css',
	'front.css',
]]);
 php
$builder->make('google-analytics', [
	'file' => 'path/to/file.php',
	'code' => 'UA-9876-5',
	'placeholder' => '%% GA %%',
]); // replaces placeholder '%% GA %%' in file
$builder->make('google-analytics', ['file' => 'path/to/file.html', 'code' => 'UA-9876-5']); // uses placeholder '<!-- GA -->' in file
$builder->make('google-analytics', ['file' => 'path/to/file.latte', 'code' => 'UA-9876-5']); // uses placeholder {* GA *} in file
 php
$builder->make('google-closure-compiler', ['file' => 'script.js']);
$builder->make('google-closure-compiler', ['files' => [
	'script-1.js',
	'script-2.js',
]]);
 php
$builder->make('less-compile', ['file' => 'styles.less']);
$builder->make('less-compile', ['files' => [
	'style-1.less',
	'style-2.less',
]]);
 php
$builder->make('minify-content', ['file' => 'file.txt']);
$builder->make('minify-content', ['files' => [
	'file-1.txt',
	'file-2.txt',
]]);
 php
$builder->make('ping-url', ['url' => 'https://example.com/migrations.php']);
$builder->make('ping-url', ['url' => 'https://example.com/migrations.php', 'validateSsl' => FALSE]); // disable SSL validation