PHPackages                             flexibuild/php-safe - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. flexibuild/php-safe

ActiveYii2-extension[Templating &amp; Views](/categories/templating)

flexibuild/php-safe
===================

Yii2 template engine. Php-Safe compiler generates php code like source but with safe echo.

0.2.0(10y ago)1294PHP

Since Apr 15Pushed 10y ago1 watchersCompare

[ Source](https://github.com/flexibuild/php-safe)[ Packagist](https://packagist.org/packages/flexibuild/php-safe)[ Docs](http://rgt.by/)[ RSS](/packages/flexibuild-php-safe/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

php-safe
========

[](#php-safe)

Yii2 template engine. Php-Safe compiler generates php code like source with next features:

- ``, `` converts to something like `` (safe converting);
- `` converts to something like `` (unsafe converting).

Usage
-----

[](#usage)

To use this extension, simply add the following code in your application configuration:

```
return [
    //....
    'components' => [
        //....
        'view' => [
            'renderers' => [
                'sphp' => [
                    'class' => 'flexibuild\phpsafe\ViewRenderer',
                    //the directory or path alias pointing to where Php-Safe engine compiled files will be stored.
                    //'compiledPath' => '@runtime/flexibuild/PhpSafe/compiled',
                    //'fileMode' => null,
                    //'mkDirMode' => 0777,
                    //the name of Yii application cache component for caching rendered files.
                    //'cacheComponent' => 'cache',
                    //'compilerConfig' => [
                        // see flexibuild\phpsafe\Compiler for more info
                    //],
                ],
            ],
        ],
        //....
    ],
    //....
];
```

Than you can create view file with extension `.sphp` and write simple php code. All `echo` structures in your view file (e.g. `
