Download the PHP package index0h/yii2-phar without Composer
On this page you can find all versions of the php package index0h/yii2-phar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download index0h/yii2-phar
More information about index0h/yii2-phar
Files in index0h/yii2-phar
Package yii2-phar
Short Description Phar builder based on Yii2
License MIT
Homepage https://github.com/index0h/yii2-phar
Informations about the package yii2-phar
yii2-phar
This module provides console interface for building PHAR archives for Yii2 applications.
Installation
The preferred way to install this extension is through composer.
or add line to require section of composer.json
Standalone usage
-
Installation
- Running
Usage
Once module is installed, modify your application configuration as follows:
You can access to yii2-phar module though console:
Options
- compress - Array of compress algorithms, \Phar::GZ, \Phar::BZ2. Creates compressed files of main phar.
- files - List of files to compile.
- folders - List of directories to compile.
- ignore - List of regexp patterns that must be ignored on build. That means if any file will match to any of patterns - it will be ignored.
- path - Path to phar file save.
- pharName - Phar name.
- signature - One of Phar signature algorithms. If it is Phar::OPENSSL - openSSLPrivateKeyAlias is required.
- openSSLPrivateKeyAlias - Alias to OpenSSL certificate, should be on \Phar::OPENSSL signature set.
- stub - Alias to stub file, if false - will not be set.
Components
Components - php classes for files modifications in phar archives. For example: remove all whitespaces from php code. Components configuration is just like yii Application components, for example:
Available components
Fixer
Fixer changes realpath functions in files that doesn't work in phar.
- match - List of regexp for files that must be modified.
- replace - Array of regexp for [
from
=>to
] for modifications in files.
Minimize
Removes all whitespaces form php files by php_strip_whitespace.
- match - List of regexp for files that must be modified.
Writing own component
Simply create class that extends index0h\phar\base\Component and implement processFile method.
For example minimize component:
FileEvent structure
- realPath - path to temporary file.
- relativePath - path in phar file.
Testing
Run tests from IDE (example for PhpStorm)
- Select Run/Debug Configuration -> Edit Configurations
- Select Add New Configuration -> PHP Script
- Type:
- File: /path/to/yii2-phar/.test.php
- Arguments run: run --coverage --html
- OK
Run tests from IDE (example for PhpStorm) inside phar archive
- Select Run/Debug Configuration -> Edit Configurations
- Select Add New Configuration -> PHP Script
- Type:
- File: /path/to/yii2-phar/.test.phar.php
- Arguments run: run --no-exit
- OK
Run tests from console
All versions of yii2-phar with dependencies
yiisoft/yii2-composer Version dev-master
yiisoft/yii2 Version dev-master