Download the PHP package teksite/icon-laravel without Composer

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

Teksite Icon Laravel

A simple, lightweight Laravel package for using SVG icons directly in Blade components.

Requirements

Installation

Install the package with Composer:

The service provider is automatically discovered by Laravel.

Publishing Assets

Publish the package configuration:

Publish the icon assets:

You can also publish each asset group separately:

The published files are placed under:

The configuration file is:

Configuration

The default configuration looks like this:

Icon Sources

The package supports multiple icon types.

By default:

Custom icon JSON files take priority when they exist.

If a configured file does not exist, the package automatically falls back to the package's bundled resource:

For example:

You can define additional custom icon types by adding them to the configuration:

The icon type must contain only letters, numbers, underscores, or hyphens.

Using Icons

The package provides two Blade components:

and:

Both components use the same icon manager and support the same main properties.

Basic Usage

or:

The default icon type is:

To use a solid icon:

Component Attributes

The component supports the following properties:

Example:

Additional HTML attributes can also be passed to the component:

The component merges the provided class with its default classes.

Generated SVG

The component renders an SVG element similar to:

Custom Component View

The default component view is configured as:

You can change it in:

For example:

The configured view receives:

The icon component also exposes its normal Blade component properties and attributes.

If the configured view does not exist, the Icon component logs an error and falls back to an inline SVG renderer.

Difference Between icon and tkicon

Both components provide the same basic functionality.

<x-icon>

<x-icon> supports a configurable Blade view through:

If the configured view exists, it is used for rendering.

If it does not exist, the component uses its built-in fallback renderer.

<x-tkicon>

<x-tkicon> always uses its built-in inline renderer.

Example:

IconManager

The main service responsible for loading and rendering icons is:

It is registered as a Laravel singleton.

You can resolve it from the container:

Get an Icon

You can retrieve an icon as a complete SVG:

By default, the icon type is:

To specify another type:

Get the Raw SVG Path

The render argument can be disabled to retrieve only the SVG path/content:

This is useful when the SVG element itself needs to be controlled by a Blade component or custom renderer.

SVG Attributes

When rendering an icon directly through IconManager, attributes can be passed as an array:

The package escapes attribute names and values before rendering them.

Check Whether an Icon Exists

For a specific type:

The result is a boolean.

Get Icon Names

Get all icon names for a specific type:

Get icon names grouped by type:

Get All Icons

Get all icons as raw path definitions:

Get all icons as rendered SVG elements:

Icon JSON Format

Icons are stored as JSON objects where the key is the icon name and the value is the SVG path/content.

Example:

Icon names must match:

Invalid icon names are ignored while loading the JSON file.

Empty or invalid path values are also ignored.

Cache

Icon loading can be cached.

Caching is disabled by default:

Enable it through the environment:

The default cache TTL is 24 hours:

You can customize the cache key:

Or configure it directly in:

Example:

Clearing the Icon Cache

The package provides:

To clear the icon cache:

For example:

This is useful after changing or replacing icon JSON files while caching is enabled.

Debugging Missing Icons

If an icon does not exist and Laravel is running with:

the package renders a small warning indicator:

with the missing icon name.

When debug mode is disabled, missing icons return an empty string instead.

Creating Custom Icons

You can add your own icon collection.

For example, create:

with:

Then configure it:

You can then use:

Blade Registration

The package registers the following Blade components:

Their aliases are registered by the service provider:

Security

Icon names and icon types are validated before lookup.

Only identifiers matching:

are accepted.

HTML attributes generated by IconManager are escaped using:

Icon path content is treated as SVG content and is inserted directly into the generated SVG. Therefore, custom icon JSON files should only contain trusted SVG definitions.

License

This package is open-sourced software licensed under the MIT license.

Author

Sina Zangiband

Email:

Contact

GitHub

Repository:


All versions of icon-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
laravel/framework Version ^13.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 teksite/icon-laravel contains the following files

Loading the files please wait ...