Download the PHP package smt/phackage-builder without Composer
On this page you can find all versions of the php package smt/phackage-builder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download smt/phackage-builder
More information about smt/phackage-builder
Files in smt/phackage-builder
Download smt/phackage-builder
More information about smt/phackage-builder
Files in smt/phackage-builder
Vendor smt
Package phackage-builder
Short Description Build cli-php files into phar-package with optional parameters.
License MIT
Homepage https://github.com/saksmt/phackage-builder
Package phackage-builder
Short Description Build cli-php files into phar-package with optional parameters.
License MIT
Homepage https://github.com/saksmt/phackage-builder
Please rate this library. Is it a good library?
Informations about the package phackage-builder
Phackage-builder
Collects php files and builds them into phar-package.
Install
composer require smt/phackage-builder
Usage
As library
use Smt\Packer\Phar;
$phar = new Phar('PATH/TO/DIRECTORY/TO/PACK', 'TARGET_PACKAGE_NAME', 'INDEX_FILE');
$phar
->addBootstrapData('const YOUR_PREDEFINED_CONSTANT = 5;')
->addFilter('!/vendor')
->addCustomFilter(function (\SplFileInfo $file) { return rand(0, 1)); }) // Heh
->prepare()
->pack()
;
// Also you can use some other cool features
// $phar = ...
use Smt\Generator\ClassBuilder;
$phar
->addBootstrapData(
(new ClassBuilder('CoolClass'))
->setNamespace('Vendor\Code') // You'll be able to use it in phar!
->addProperty('prop')
->makePublic()
->makeStatic()
->setValue('\'SOME_SECRET_TOKEN_FOR_EXAMPLE\'')
->end()
->addMethod('get awesomeness') // yeah you can write exactly right this! this would be converted to "getAwesomeness"
->setReturnValue('\Grab it!\'')
->end()
->getCode()
)
->prepare()
->pack()
;
// And the last cool feature
// $phar = ...
use Smt\Generator\DefineGenerator;
$phar
->addBootstrapData(new DefineGenerator([
'SOME_CONST' => 'value',
'SomeClass.SOME_CONST' => 'value',
'SomeClass::someVar' => '\'value\'', // Warning here you MUST to write quotes if you use strings
'Some\Name\Space\SomeClass.CONSTANT' => 'value',
]))
->prepare()
->pack()
;
As package
php bootstrap.php pack PATH/TO/DIR -dSomeClass.SOME_CONST='value'
, for more see "last cool feature" from "As library" section.
All versions of phackage-builder with dependencies
PHP Build Version
Package Version
The package smt/phackage-builder contains the following files
Loading the files please wait ....