denason/persian-slug
Larablocks Analysis
denason/persian-slug works with Laravel 9 to 12 (latest release 1.1.0, Apr 14, 2025).
Recommendation checks
Use with careUse with care: meets 0 of 4 checks.
- Latest release doesn't support Laravel 13, the current version
- No release in the last 12 months (last: Apr 14, 2025)
- 160 downloads a month (needs 10,000)
- 6 GitHub stars (needs 100)
State
Quiet- Last stable release: Apr 14, 2025.
- No releases in the last 12 months.
- First released: Apr 13, 2025.
- Monthly downloads: 160.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Nov 30, 2026.
| Install | |
|---|---|
composer require denason/persian-slug |
|
| Latest Version: | 1.1.0 |
| PHP: | >=8.0 |
| Laravel: | 9 – 12 |
| License: | MIT |
| Last Updated: | Apr 14, 2025 |
| Links: | GitHub · Packagist |
Persian Slug Generator for Laravel
A lightweight and SEO-friendly Persian slug generator for Laravel. Convert Persian, Arabic, and English strings into URL-friendly slugs with ease.
Features
- ✅ Converts Persian, Arabic, and English text to SEO-friendly slugs
- 🔢 Replaces Persian and Arabic numbers with English equivalents
- 🔀 Optional support for Laravel's
Str::slug() - 🧪 Well-tested with PHPUnit
- 🧬 Includes
HasSlugtrait for automatic slug generation in Eloquent models
🎯 معرفی پکیج Persian Slug
Persian Slug یک پکیج سبک و کاربردی برای ساخت اسلاگهای سئو-پسند از متون فارسی و انگلیسی در پروژههای لاراول است.
🚀 امکانات کلیدی
- ✅ ساخت اسلاگ تمیز و خوانا از متون فارسی و انگلیسی
- ✅ تبدیل خودکار اعداد فارسی و عربی به معادل انگلیسی
- ✅ استفاده از Helper فانکشن
slug_fa()برای سادگی بیشتر - ✅ افزودن Trait
HasSlugبه مدلها برای ذخیره خودکار و یکتای اسلاگ - ✅ قابلیت استفاده از Str::slug() داخلی لاراول
- ✅ کاملاً سازگار با Laravel 9 به بالا
- ✅ بدون نیاز به تنظیمات خاص
Installation
composer require denason/persian-slug
If you're using Laravel < 5.5, register the service provider manually in config/app.php:
Denason\PersianSlug\PersianSlugServiceProvider::class,
Usage
1. Using the Helper Function
slug_fa('سلام دنیا ۱۲۳'); // Output: سلام-دنیا-123
2. Using the Static Method
use Denason\PersianSlug\SlugGenerator;
SlugGenerator::make('سلام دنیا ۱۲۳'); // Output: سلام-دنیا-123
Optional Parameters:
SlugGenerator::make(
string $text,
string $separator = '-',
bool $convertNumber = true,
bool $useLaravelSlug = false
): string
3. Using HasSlug Trait in Models
Automatically generate slugs when saving Eloquent models:
use Denason\PersianSlug\Concerns\HasSlug;
class Post extends Model
{
use HasSlug;
protected $slugSource = 'title'; // Field to slugify
protected $slugField = 'slug'; // Field to store slug
}
This will auto-generate a unique slug based on the title attribute when saving the model.
Requirements
- PHP 8.0 or higher
- Laravel 9, 10, 11, or 12
License
MIT © Mohammad Asadi
Contributions
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
Credits
Crafted with ❤️ by Mohammad Asadi, Iran 🇮🇷
Links
- 📦 Packagist: denason/persian-slug
- 💻 GitHub: github.com/denason/persian-slug
- 🌐 Website: denason.ir
Alternatives to denason/persian-slug
Single- and multi-language (json/jsonb locale-map) slugs for Eloquent: multiple...
The registry of a site's public addresses: one flat namespace, one row per addre...
Laravel package that allows storing in database (or other sources) urls to redir...
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.1.0 | >=8.0 | ^9.0| | MIT | |
| 1.0.1 | >=8.0 | ^9.0| | MIT | |
| 1.0.0 | >=8.0 | ^10.0| | MIT |