Download the PHP package clubstudioltd/craft-inline-svg without Composer

On this page you can find all versions of the php package clubstudioltd/craft-inline-svg. 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 craft-inline-svg

Craft CMS Inline SVG

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

A Twig extension for Craft CMS that helps you inline SVGs in your templates.

Why?

While Craft provides an svg() function out of the box, you need to pass an Asset element or full path every time you use it. If all of your SVGs are stored in the same (or a handful of) directories, this plugin allows you to use shorter, more convenient syntax to inline your SVG.

Installation

Install via the Plugin Store within your Craft 3 installation or using Composer:

Configuration

The plugin comes with a config.php file that defines some sensible defaults.

If you want to set your own values you should create a inlinesvg.php file in your Craft /config directory. The contents of this file will get merged with the plugin defaults, so you only need to specify values for the settings you want to override.

Example Config

You should add the paths to all of the directories where your SVG files are stored to the paths configuration array.

If you'd like to add a class to every SVG that is output you should add it to the class configuration value. Separate multiple classes with spaces.

Basic Usage

Once activated and configured you can use the inlineSvg() function in your templates.

In this example the plugin will look for a file called icon.svg in all of the configured paths and return the first match it finds.

Adding additional classes

The plugin will add any classes defined in your configuration file to the SVG output. You can add more by passing them as a second parameter:

You can override the classes defined in your configuration file ad hoc using the class key:

this would output <svg class="override-class" ... > regardless of any other classes defined in your config file.

Adding additional parameters

You can add additional parameters by passing them as an array:

which would output:

Sanitising & Namespacing

As the inlineSvg() helper uses the native Craft svg() helper under the hood, you can still make use of the sanitising and namespacing it offers:

Credits

Inspired by blade-svg


All versions of craft-inline-svg with dependencies

PHP Build Version
Package Version
Requires craftcms/cms Version ^4.0|^5.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 clubstudioltd/craft-inline-svg contains the following files

Loading the files please wait ....