teariot/beautyslug
Composer 安装命令:
composer require teariot/beautyslug
包简介
Lightweight PHP library for generating random readable slugs.
关键字:
README 文档
README
BeautySlug is a lightweight, flexible PHP library for generating beautiful, readable slugs.
🚀 Installation
Install via Composer:
composer require teariot/beautyslug
⚡ Quick Usage
use BeautySlug\BeautySlug; use BeautySlug\SlugWords; // Basic random slug echo BeautySlug::slug(); // Example: wonderful-tree // Slug with a color and an animal echo BeautySlug::slug([ SlugWords::color(1), SlugWords::animal(1), ]); // Example: blue-lion // Slug with digits appended echo BeautySlug::slug([ SlugWords::adjective(1), SlugWords::noun(1), ], [ 'appendDigits' => true, 'digitsCount' => 5, ]); // Example: fancy-robot-48291
⚙️ Options
| Option | Type | Description | Default |
|---|---|---|---|
separator |
string |
Separator between words | - |
appendDigits |
bool |
Append random digits at the end | false |
digitsCount |
int |
Number of digits to append if enabled | 4 |
You can override options by passing an array as the second parameter to slug().
🧩 Available Word Categories
BeautySlug uses predefined word lists:
adjectivenouncolorseasonemojiverbanimalcosmos
You can directly access random words:
SlugWords::adjective(2); // Get 2 random adjectives SlugWords::noun(1); // Get 1 random noun SlugWords::color(1); // Get 1 random color
📂 Example Script
See the examples/usage.php file for more examples.
To run:
php examples/usage.php
📄 License
Released under the MIT License.
Built with ❤️ by Teariot
teariot/beautyslug 适用场景与选型建议
teariot/beautyslug 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.81k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 04 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「slug」 「slugify」 「random string」 「slug generator」 「text generator」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 teariot/beautyslug 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 teariot/beautyslug 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 teariot/beautyslug 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A full-featured, simple, clean and pure functional implementation for creating slugs
TitleWithSlugInput - Easy Permalink Slugs for the FilamentPHP Form Builder (PHP / Laravel / Livewire)
A Symfony2 Bundle to slugify swedish texts
Adds slugify twig extensions to your craft install.
Slug Generator
A library to extend Object capabilities.
统计信息
- 总下载量: 2.81k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-28