PHP code example of kodicms / laravel-assets

1. Go to this page and download the library: Download kodicms/laravel-assets 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/ */

    

kodicms / laravel-assets example snippets


PackageManager::add('jquery')
	->js(null, 'https://code.jquery.com/jquery-2.1.4.min.js');

PackageManager::add('jquery-ui')
	->js(null, 'https://code.jquery.com/ui/1.11.4/jquery-ui.min.js', 'jquery')
	->css(null, 'https://code.jquery.com/ui/1.11.4/themes/ui-lightness/jquery-ui.css');

PackageManager::add('custom')
	->js(null, '...')
	->js('custom.second.js', '...', 'custom')
	->css(null, '...')
	->css('custom.second.css', '...');

use KodiCMS\Assets\Contracts\SocialMediaTagsInterface;

class Article extends Model implements SocialMediaTagsInterface
{
	...
}

use Meta;

class ArticleController extends Controller
{
	public function show($articleId)
    {
        $article = Article::find($articleId);

        Meta::loadPackage('jquery')
        	->addSocialTags($article);

		Meta::addCss('style', url('css/style.css'));
		Meta::addJs('scripts', url('js/scripts.js'), 'jquery');

		Meta::addJsElixir();
		...
    }
}