Download the PHP package developvi/laravel-slug-i18n without Composer
On this page you can find all versions of the php package developvi/laravel-slug-i18n. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download developvi/laravel-slug-i18n
More information about developvi/laravel-slug-i18n
Files in developvi/laravel-slug-i18n
Package laravel-slug-i18n
Short Description A Laravel package to generate multilingual slugs (UTF-8) with optional transliteration skipping for specific locales, with spatie/laravel-sluggable integration.
License MIT
Informations about the package laravel-slug-i18n
Laravel Slug I18n
A professional Laravel package to generate multilingual UTF-8 slugs with smart, configurable skipping of transliteration for specific locales (like Arabic, Farsi, Urdu, etc.), while keeping Laravel’s original Str::slug() behavior intact.
🚀 Features
- Generate clean, SEO-friendly slugs for any language
- Skip transliteration automatically for configurable locales (e.g., ar, fa, ur)
- Fully compatible with Laravel’s Str helper
- Supports Laravel 9, 10, 11, 12, 13
- Works with spatie/laravel-sluggable out of the box
- Zero config (but highly configurable if needed)
- Auto-discovered (no need to manually register service provider)
- Publishable config file for easy customization
- Supports custom dictionary replacements and force skip
📦 Installation
⚙️ Configuration
You can publish the config file with:
.env Options
- SLUG_I18N_ENABLED: Enable or disable the package (default: true)
- SLUG_I18N_SKIP_LOCALES: Comma-separated list of locales to skip transliteration for (e.g.,
ar,fa,ur)
Example:
config/slug-i18n.php
You can also edit the config file directly for advanced control:
🧑💻 Usage
Basic Usage
Use the new macro Str::slugI18n for full control:
Macro Signature
- $title: The string to slugify
- $separator: Word separator (default: '-')
- $language: Language/locale code (e.g., 'ar', 'en', ...)
- $dictionary: Custom replacements (e.g., ['@' => 'at'])
- $forceSkip: If true, always skip transliteration regardless of config
Advanced Usage
🔗 spatie/laravel-sluggable Integration
When spatie/laravel-sluggable v4+ is installed, the package swaps its generate_slug action for GenerateSlugI18nAction, so every HasSlug model slugifies through SlugI18n. Uniqueness, suffixes and all other spatie options keep working as before.
Set the slug language on the model and add it to skip_locales:
If your app already sets its own sluggable.actions.generate_slug, it is left untouched. To turn the integration off:
🧪 Testing
To run the package tests:
📝 License
MIT
👤 Author
Eslam El Sherif
[email protected]
💡 Example in Laravel Route
🤝 Contributing
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.