Skip to content
a php helper for static assets.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests
.editorconfig
.gitattributes
.gitignore
.php_cs
.scrutinizer.yml
.travis.yml
LICENSE
README.md
assets.php
composer.json
phpunit.xml

README.md

Assets is a php helper for working with static assets & embedding.

📦 This package helps you to add toastr.js notifications to your Laravel 5 project.

Build Status Latest Stable Version Latest Unstable Version Build Status Scrutinizer Code Quality Code Coverage Total Downloads License

Install

You can install the package using composer

$ composer require yakuzan/assets

alternative instalation :

if you don't want to use composer you can still use assets, just download the file assets.php put in a subfolder and just include it like

  include 'path/to/your/subfolder/assets.php';

Usage

display jquery link jquery($version = '3.2.1', $src = null)

echo jquery();
output => <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

you can overrite the jquery version like this:

echo jquery(2.0);
output => <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0/jquery.min.js"></script>

or even a local version of jquery by providing a second parameter, the source of the file :

echo jquery(null, 'path/to/jquery.min.js');
output => <script src="path/to/jquery.min.js"></script>

similar function

  • fontawesome($version = '4.7.0', $href = null)
  • bootstrap_js($version = '4.0.0-alpha.6', $src = null)
  • bootstrap_css($version = '4.0.0-alpha.6', $href = null)

to include a font-awesome tag very easily just use this helper function :

echo icon('edit);
// output : <i class="fa fa-edit"></i>

echo icon('edit', 'span'); // to switch from 'i' tag to a 'span'
// output : <span class="fa fa-edit"></span>

to insert a image tag it's super easy img($src = null, $attrs = [])

echo img('profile.png');
// output : <img stc="profile.png" />

echo img('profile.png', ["class" => "rounded small", "id" => "profile"]);// if you want to add custom attributs
// <img src="profile.png" class="rounded small" id="profile" />

similar methods

  • css($href = '', $attrs = [])
  • less($href = '', $attrs = [])
  • js($src = null, $default = '', $attrs = [])
You can’t perform that action at this time.