PHP code example of mouf / html.utils.weblibrarymanager
1. Go to this page and download the library: Download mouf/html.utils.weblibrarymanager 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/ */
mouf / html.utils.weblibrarymanager example snippets
class MyController {
/**
* @var $template TemplateInterface
*/
protected $template;
...
public function myAction() {
$webLibraryManager = $this->template->getWebLibraryManager();
...
}
}
// Import a JS file from your project
// The file is relative to your ROOT_URL
$webLibraryManager->addJsFile('src/javascript/myJsFile.js');
// Import a JS file from a CDN
$webLibraryManager->addJsFile('https://code.jquery.com/jquery-2.1.1.min.js');
// Import a CSS file from your project
// The file is relative to your ROOT_URL
$webLibraryManager->addCssFile('src/css/myStyle.css');