定制 tim-oetting/lucide-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tim-oetting/lucide-php

Composer 安装命令:

composer require tim-oetting/lucide-php

包简介

A modern PHP package for Lucide icons

README 文档

README

A modern PHP package for integrating Lucide icons into your PHP projects.

Installation

You can install the package via composer:

composer require tim-oetting/lucide-php

Requirements

  • PHP 8.0 or higher

Usage

Basic Usage

use TimOetting\LucidePhp\Lucide;

// Using the static icon method
echo Lucide::icon('github');

// Using magic method (alternative syntax)
echo Lucide::github();

Customizing Icons

The package provides a fluent interface to customize your icons:

// Add CSS classes
echo Lucide::github()->withClass('w-6 h-6 text-gray-500');

// Set custom size
echo Lucide::github()->withSize(24);

// Add custom attributes
echo Lucide::github()->withAttributes([
    'class' => 'icon',
    'stroke-width' => '1.5',
    'aria-hidden' => 'true'
]);

// Chain methods
echo Lucide::github()
    ->withSize(32)
    ->withClass('text-blue-500')
    ->withAttributes(['stroke-width' => '1.5']);

Error Handling

The package will throw an IconNotFoundException if the requested icon doesn't exist:

try {
    echo Lucide::nonexistentIcon();
} catch (TimOetting\LucidePhp\IconNotFoundException $e) {
    // Handle the error
}

How It Works

The package loads SVG icons from the icons directory and allows you to manipulate them with various attributes. All icons are rendered as inline SVG, making them easy to style with CSS.

Features

  • 🚀 Simple and intuitive API
  • ⚡️ Fluent interface for icon customization
  • 🎨 Full support for custom attributes
  • 🔒 Secure SVG rendering with proper HTML escaping
  • 💪 Type-safe with PHP 8.0 features
  • 🎯 Zero dependencies

License

The MIT License (MIT). Please see the License File for more information.

Credits

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-19