Download the PHP package hebinet/laravel-svg-icons without Composer

On this page you can find all versions of the php package hebinet/laravel-svg-icons. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-svg-icons

Laravel SVG Icons

Allows to inline Font Awesome 5+'s SVG icons without javascript via a simple Laravel Blade directive.

Installation

Install composer package

You can install it using Composer:

Optionally, you can also publish the config file of the package.

Install SVG font

As a next step you need to install Font Awesome via npm:

The path to the SVG files in the npm package is configured by default.

But you can change the path via the config parameter path_to_fontawesome in config\icons.php if you want to.

Add Font Awesome SVG CSS-Style

To display the icons correctly you need to add an additional css file which can be found in the npm @fortawesome/fontawesome-free package.

I would recommend using Webpack to publish the file in the public/css directory.

Afterwards you need to add the svg-icons.css file in the head section of your site.

In order to inherit the font color of the parent correctly you have to add the following style declaration in your global CSS file

Usage

You can now add the new @icon blade directive to add the inline SVG icon. The argument for the directive is the same as you would use for Font Awesome icons.

You can use the directive as followed:

Examples

Usage in a Blade view:

Usage in a Controller method or normal PHP code:

Optionally you can omit the icon string from the constructor and instead provide it in the render method like this

This package also provides an Icon Facade. Unfortunately, the way Facades work, you have to provide the icon string in the render method instead of the constructor.

First you have to 'register' the Facade in you app.php file at the end of the alias array like this

After that you can use the Facade like this

Additional Route

If the setting $config['route']['enabled'] is true (default: true), an additional route will be registered to provide an Url-Based fetch for the SVG Icon Content.

With this route you can load the Icon via a normal GET-Operation, so you can use the Icon also in "Non Blade"-Scenarios like Vue-Components.

You can use it like this:

It will throw an Symfony\Component\HttpKernel\Exception\NotFoundHttpException if the requested icon doesn't exist.

Examples

Accessibility

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-svg-icons with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|^8.0
illuminate/contracts Version ~5.8.0|^6.0|^7.0|^8.0
illuminate/http Version ~5.8.0|^6.0|^7.0|^8.0
illuminate/support Version ~5.8.0|^6.0|^7.0|^8.0
ext-dom Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hebinet/laravel-svg-icons contains the following files

Loading the files please wait ....