Download the PHP package flexibuild/php-safe without Composer
On this page you can find all versions of the php package flexibuild/php-safe. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download flexibuild/php-safe
More information about flexibuild/php-safe
Files in flexibuild/php-safe
Package php-safe
Short Description Yii2 template engine. Php-Safe compiler generates php code like source but with safe echo.
License
Homepage http://rgt.by/
Informations about the package php-safe
php-safe
Yii2 template engine. Php-Safe compiler generates php code like source with next features:
<?= 'smth' ?>
,converts to something like
(safe converting);converts to something like
(unsafe converting).
Usage
To use this extension, simply add the following code in your application configuration:
Than you can create view file with extension .sphp
and write simple php code.
All echo
structures in your view file (e.g. <?=
, will be converted to smth like
.
After executing this code prints raw 'smth' and echoes safe '1', because php engine will echo result of print function (that always return 1).
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require section of your composer.json.
Gii generators
This extension allows you to configure your gii module for using standard yii generators with phpsafe files. For example, you may add it in you main-local file:
Console commands
This extension allows you to exec the following console commands:
-
yii phpsafe/flush-all
Flushes all compiled by phpsafe engine files. yii phpsafe/compile-all
Compiles all phpsafe files to php files.
For using console commands you must configure console with renderers like in web configuration. You must add phpsafe console controller in your console controller map configuration:
Note:
- Extension has default config for yii simple base application. For yii-advanced application you must configure directories so console will may "see" it.
- For better debugging we suggest you to use \flexibuild\phpsafe\web\ErrorHandler in your web application, or to add 'use \flexibuild\phpsafe\web\ErrorHandlerTrait;' in own error handler.