Download the PHP package yassinedoghri/php-icons without Composer

On this page you can find all versions of the php package yassinedoghri/php-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 php-icons

# PHPIcons 🐘 🙂 **A convenient PHP library to render svg icons.** [![Latest Stable Version](https://poser.pugx.org/yassinedoghri/php-icons/v)](https://packagist.org/packages/yassinedoghri/php-icons) [![Total Downloads](https://poser.pugx.org/yassinedoghri/php-icons/downloads)](https://packagist.org/packages/yassinedoghri/php-icons) [![codecov](https://codecov.io/gh/yassinedoghri/php-icons/graph/badge.svg?token=P8CG7J5HOQ)](https://codecov.io/gh/yassinedoghri/php-icons) [![License](https://img.shields.io/github/license/yassinedoghri/php-icons?color=green)](https://packagist.org/packages/yassinedoghri/php-icons) [![PHP Version Require](https://poser.pugx.org/yassinedoghri/php-icons/require/php)](https://packagist.org/packages/yassinedoghri/php-icons)

Get access to over 200,000 icons from more than 150 open source icon sets directly from your php files!

Thanks to Iconify ❤️

🚀 Getting started

1. Install via composer

2. Configure

Run the following command to initialize the configuration file:

This will prompt you to create a php-icons.php config file in the root of your project. See config reference for more info.

3. Use anywhere

3.1. icon(string $iconKey, array $attributes) function

Use the global icon(…) function in your view files with the icon key ({prefix}:{icon}) as parameter:

👉 To add attributes, use the second parameter or call the attr() or attributes() methods:

[!TIP]
Find and copy the icon keys of popular open source icon sets from Iconify's index.

3.2. Scan source files to load icons

[!IMPORTANT]
When first defining icons, a placeholder ( by default) will be displayed.\ Make sure to run the scan command to load the SVGs.

The scan command will perform a static analysis of all PHP files in your configured paths to identify icon keys ({prefix}:{name}) and download the corresponding icons.

Using the icon identifier by default:

  1. icon(…) functions

  2. @icon(…) annotations in comments

⚙️ Config reference

Your config file is loaded by both the php-icons CLI tool and PHPIcons class, it should look like this:

Paths

withPaths([])

List of paths to your source files. PHP files will be parsed and scanned for discovering the icons you have defined.

API Hosts

withAPIHosts([])

Iconify API hosts to query for downloading svg icons. Starts by querying the first host, the rest is used as backup.

Defaults to Iconify's public hosts: ["https://api.iconify.design","https://api.simplesvg.com", "https://api.unisvg.com"]

Local Icon Sets

withLocalIconSets([])

If you have custom icons, php-icons can look them up locally in your file system instead of calling for the Iconify API.

[!IMPORTANT]
php-icons will look for {name}.svg files in your local icon sets

Takes in an associative array with the icon set prefix as the key and its path as value.

Example

Default Prefix

withDefaultPrefix('')

Default icon set prefix to use when none is set.

Example

With material-symbols set as default prefix:

Default Icon

withDefaultIcon()

Default icon to use when an icon has not been found.

Takes in an icon key {prefix}:{name}. If a prefix is not set, the default prefix will be used instead.

Default Icon Per Set

withDefaultIconPerSet([])

Default icon to use when an icon has not been found in a set.

Takes in an associative array, with the key being the icon set prefix, and the value being the default icon.

Placeholder

withPlaceholder('�')

String to show when icon is not found or unknown.

Defaults to (REPLACEMENT CHARACTER).

Identifiers

withIdentifiers([])

Function or method names to match for identifying icon keys in your source files.

Defaults to ['icon'].

🖥️ CLI commands

❤️ Acknowledgments

This wouldn't have been possible without the awesome work from the Iconify team and designers that maintain the many open source icon sets.

Inspired by astro-icon, blade-icons and rector.

📜 License

Code released under the MIT License.

Copyright (c) 2024-present, Yassine Doghri (@yassinedoghri).


All versions of php-icons with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
composer-runtime-api Version ^2.2
adhocore/cli Version ^v1.9.3
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 yassinedoghri/php-icons contains the following files

Loading the files please wait ....