An open API service indexing awesome lists of open source software.

https://github.com/yassinedoghri/codeigniter-icons

A CodeIgniter4 library with convenient helper functions to render svg icons using https://github.com/yassinedoghri/php-icons.
https://github.com/yassinedoghri/codeigniter-icons

codeigniter-library codeigniter4 iconify icons svg-icons

Last synced: 6 months ago
JSON representation

A CodeIgniter4 library with convenient helper functions to render svg icons using https://github.com/yassinedoghri/php-icons.

Awesome Lists containing this project

README

          

# CodeIgniter Icons 🔥 🙂

A [CodeIgniter4](https://codeigniter.com/) library with convenient helper
functions to render svg icons using
[php-icons](https://github.com/yassinedoghri/php-icons).

[![Latest Stable Version](https://poser.pugx.org/yassinedoghri/codeigniter-icons/v)](https://packagist.org/packages/yassinedoghri/codeigniter-icons)
[![Total Downloads](https://poser.pugx.org/yassinedoghri/codeigniter-icons/downloads)](https://packagist.org/packages/yassinedoghri/codeigniter-icons)
[![License](https://img.shields.io/github/license/yassinedoghri/codeigniter-icons?color=green)](https://packagist.org/packages/yassinedoghri/codeigniter-icons)
[![PHP Version Require](https://poser.pugx.org/yassinedoghri/codeigniter-icons/require/php)](https://packagist.org/packages/yassinedoghri/codeigniter-icons)

## 🚀 Getting started

### 0. Prerequisites

Usage of CodeIgniter Icons requires the following:

- A CodeIgniter 4.3.5+ based project
- Composer for package management
- PHP 8.1+

### 1. Install via composer

```sh
composer require yassinedoghri/codeigniter-icons
```

### 2. Setup

1. [init and configure PHPIcons](https://github.com/yassinedoghri/php-icons),
ie. create the PHPIcons config file.

2. add icons helper to your `app/Config/Autoload.php` file:

```php
public $helpers = [/*...other helpers...*/, 'icons'];
```

### 3. Usage

Use the `icon(string $iconKey, array $attributes)` helper function in your View
files to render svg icons:

```php
= icon('material-symbols:bolt') ?>
//
//
//

= icon('material-symbols:bolt', ['class' => 'text-2xl', "style" => "color: yellow;"]) ?>
// ...

= icon('material-symbols:bolt')
->attr('class', 'text-2xl')
->attr('style', 'color: yellow;') ?>
// ...
```

For more usage info, see
[php icons docs](https://github.com/yassinedoghri/php-icons).

## ⚙️ Configuration

Checkout PHPIcons config reference to tweak things as you please.

```php
// new file - app/Config/Icons.php