Code Monkey home page Code Monkey logo

codeigniter-icons's Introduction

CodeIgniter Icons ๐Ÿ”ฅ ๐Ÿ™‚

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

A CodeIgniter4 library with convenient helper functions to render svg icons using php-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

composer require yassinedoghri/codeigniter-icons

2. Setup

  1. init and configure PHPIcons, ie. create the PHPIcons config file.

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

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

3. Usage

Use the icon(string $iconKey) or phpicons(string $iconKey) helpers in your View files to render svg icons:

<?= icon('material-symbols:bolt') ?>
// <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
//      <path fill="currentColor" d="m8 22l1-7H4l9-13h2l-1 8h6L10 22z"/>
// </svg>

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

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

For more usage info, see php icons docs.

โš™๏ธ Configuration

Checkout PHPIcons config reference to tweak things as you please.

// new file - app/Config/Iconify.php
<?php

declare(strict_types=1);

namespace Config;

// ...
use CodeIgniterIconify\Config\Iconify as CodeIgniterIconify;

class Iconify extends CodeIgniterIconify
{
    public string $phpIconsConfigPath = ROOTPATH . 'php-icons.php';
}

๐Ÿ“œ License

Code released under the MIT License.

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

codeigniter-icons's People

Contributors

yassinedoghri avatar

Stargazers

Rajanan avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.