PHP code example of pamiris / javascript-constants
1. Go to this page and download the library: Download pamiris/javascript-constants library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pamiris / javascript-constants example snippets
//src/myprocject/controller.php
...
use Pamiris\JavascriptConstants\Mapper as ConstantMapper;
...
function someAction()
{
$jsConstants = ConstantMapper::getJavascriptObject('MyNamespace\MyClass');
$this->renderTemplate('mypage',[
...
'scriptContent' => $jsConstants
]);