Download the PHP package robwdwd/svg-icon-bundle without Composer

On this page you can find all versions of the php package robwdwd/svg-icon-bundle. 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 svg-icon-bundle

SVGIcon Symfony Bundle

Symfony Bundle for reading SVG Files and outputting in HTML Markup.

What is the SVGIcon Bundle?

SVGIcon is a symfony bundle to read SVG files (such as material design icons, bootstrap icons, etc) and can be used to output inline HTML either with the twig function or by using SVGIcon as a service.

Features

SVGIcon supports the following:

Requirements

SVGIcon PHP Class requires the following:

Installation

Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.

Applications that use Symfony Flex

Open a command console, enter your project directory and execute:

Applications that don't use Symfony Flex

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:

Configuration

Configuration is done in config/packages/robwdwd_svg_icon.yaml although this can be any filename.

Here is an example configuration using webpack encore for material design icons and a normal file path for bootstrap icons.

For webpack encore managed icons the base_dir for each icon should be the public directory of your symfony project and the icon_dir should be the build directory and the subdirectory under it where webpack encore copies the icon files. The icon_dir plus the icon filename is used to lookup the icon in the webpack manifest.json.

For icons not managed by webpack Encore (for example directly from the node_modules directory) set the base_dir to be %kernel.project_dir% and the icon_dir to be the location under and including node_modules. However icon_dir and base_dir are simply concatenated together for icon packages not managed by webpack encore.

Icon installation

Icons should be installed as per the normal icon installation process. For example to install bootstrap icons and material design icons.

Webpack Encore

Use webpack encore to copy the SVG icons to your build directory by using copyFiles. The following example copies the material design icons to your public build directory under icons/mdi and the boostrap icons under icons/bsi. Versioning will be used if you have it enabled.

With webpack set to true in the configuration file the bundle will load the icon file by looking up it's location in the default webpack manifest.

Usage and Examples

The bundle provides a twig function and a service to load and get the HTML for SVG icons.

Default attributes and styles

By default the bundle sets width and height to 16 and the viewBox to 0 0 16 16 and fill to currentColor. These will be used if the SVG icon does not already have these attributes and you have not overridden them in the twig call.

Attributes set in the twig call will always beused over the attributes/styles in the SVG file and the defaults. SVG File always overrides the default.

Width and height are optional configuration for icon packages and will override the bundle default, the icon width and height attributes but not any width and height in the template call.

The bundle takes the follow precedence order: Default->SVG File->Dimensions->Twig Call.

Twig

The SVGIcon bundle provides a twig function to inline SVG icon HTML markup into templates. The function takes the icon package name and the name of the icon (filename without the .svg extension). It allows for optional attributes and styles to be applied to the icon.

Simple use

To embed to Material design pencil icon into your html use the following. Any attributes and styles from the icon will be used as well as the defaults if the icon does not include them.

Advanced use

To overwrite the width and height attributes.

Set the width and height and class and set the fill colour to red.

You can also set the fill colour as an attribute which will get converted into a style automatically. Any attribute which should be a style will be converted.

As a service

You can use the SVGIcon service in your controllers or services to manually generate SVGIcons.


All versions of svg-icon-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
meyfa/php-svg Version ^0.14
symfony/config Version >=6.0
symfony/dependency-injection Version >=6.0
symfony/framework-bundle Version >=6.0
symfony/twig-bundle Version >=6.0
symfony/asset Version >=6.0
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 robwdwd/svg-icon-bundle contains the following files

Loading the files please wait ....