Download the PHP package constant-exposure/constant-exposure-bundle without Composer
On this page you can find all versions of the php package constant-exposure/constant-exposure-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download constant-exposure/constant-exposure-bundle
More information about constant-exposure/constant-exposure-bundle
Files in constant-exposure/constant-exposure-bundle
Package constant-exposure-bundle
Short Description Expose php constants to front.
License MIT
Informations about the package constant-exposure-bundle
Constant Exposure Bundle
This Symfony Bundle is useful if you need to expose constants to front.
Install
Composer
composer require constant-exposure/constant-exposure-bundle:^2.2
Load the bundle
In config/bundles.php
, add this line:
Usage
Define constants to expose
Create a file config/packages/constant_exposure.yaml
in your project. Then, configure constants to expose.
Use constants in JavaScript
Add this line in your Twig template. Pass as parameter a name for your JavaScript object.
Get them in Javascript:
Route exposure
If you need to expose your constants on a route, add these lines in your routing file:
Then, you can access it with this url:
- /constant-exposure.json for a JSON format
- /constant-exposure.xml for a XML format
- /constant-exposure.csv for a CSV format
All versions of constant-exposure-bundle with dependencies
symfony/cache Version ^3.4|^4.0|^5.0|^6.0
symfony/serializer Version ^3.4|^4.0|^5.0|^6.0
symfony/config Version ^3.4|^4.0|^5.0|^6.0
symfony/dependency-injection Version ^3.4|^4.0|^5.0|^6.0
symfony/http-foundation Version ^3.4|^4.0|^5.0|^6.0
symfony/http-kernel Version ^3.4|^4.0|^5.0|^6.0
symfony/framework-bundle Version ^3.4|^4.0|^5.0|^6.0
symfony/twig-bundle Version ^3.4|^4.0|^5.0|^6.0