alexeymezenin/laravel-russian-slugs
Larablocks Analysis
alexeymezenin/laravel-russian-slugs works with any PHP project: the latest release (0.9, Apr 27, 2016) doesn't depend on Laravel.
Laravel 5 in earlier releases.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- No release in the last 12 months (last: Apr 27, 2016)
- 0 downloads a month (needs 10,000)
- 26 GitHub stars (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: Apr 27, 2016.
- No releases in the last 12 months.
- First released: Apr 4, 2016.
- 4 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Dec 3, 2026.
| Install | |
|---|---|
composer require alexeymezenin/laravel-russian-slugs |
|
| Latest Version: | 0.9 |
| PHP: | >=5.4.0 |
| Older releases: | 5 |
| License: | MIT |
| Last Updated: | Feb 23, 2022 |
| Links: | GitHub · Packagist |
The package is not supported anymore
Introduction
This package offers easy to use cyrillic slugs like 'Как_вырастить_дерево' and Yandex transliterated 'kak-vyrastis-derevo' slugs and their variations with lowercased letters and different separators.
Installation
Start with editing your Laravel project's composer.json file, add this line to the require section:
"require": {
....
"alexeymezenin/laravel-russian-slugs": "0.9.*"
After that run this command to install package:
composer update
Now, insert these two lines into provider and aliases arrays in config/app.php:
'providers' => [
....
AlexeyMezenin\LaravelRussianSlugs\SlugsServiceProvider::class,
'aliases' => [
....
'Slug' => AlexeyMezenin\LaravelRussianSlugs\SlugsFacade::class,
Finally, you need to register config file and slugs-related commands by running:
php artisan vendor:publish
Using slugs
To use package, you need to update your models with thisuse clause:
class Articles extends Model
{
use \AlexeyMezenin\LaravelRussianSlugs\SlugsTrait;
Then you need to create slug column in a migration:
$table->string('slug');
To use auto slug creation feature add slugFrom property to your model:
protected $slugFrom = 'article_name';
In this case, every time when you're saving data to a DB, package tries to create (but not recreate) a new slug and save it:
$article = Article::create(['article_name' => 'Как вырастить дерево?']);
Of course, that doesn't work with mass inserts and updates when you're updating multiple rows with one query.
Manual slug creation
To create new record with a slug use reslug() method. This will add slug, based on name column:
$article = new Article;
$article->name = 'How to grow a tree?';
$article->reslug('name');
$article->save();
You can update existing record and add a slug:
$article = Article::find(1);
$article->reslug('name');
$article->save();
If slug already exists, but you need to recreate it, use forced reslug:
$article->reslug('name', true);
Alternatively, you can use Slug facade to manually work with slugs:
$article = Article::find(1);
$article->update([
'slug' => Slug::build($article->name)
]);
findBySlug() method allows you to find a model by it's slug:
$slug = 'how-to-grow-a-tree';
$article = Article::findBySlug($slug);
echo $article->name; // Will output "How to grow a tree?"
Configuration
To configure a package you should edit config/seoslugs.php file.
delimiter is a symbol which replaces all spaces in a string. By default it's '_', but also can be '-'.
urlType is a type of slug:
Default is 1. Used for URLs like /категория/книги_в_москве
2 is for traslitterated URLs like /kategoriya/knigi_v_moskve, Yandex rules used to transliterate URL.
keepCapitals is false by default. When true it keeps capital letters in a slug, for example: /книги_в_Москве
slugColumnName sets the name of a slug column. slug by default.
Commands
There are three console commands available in the package:
php artisan slug:auto {table} {column} command creates and executes migration, reslugs a table (creates slugs for all rows) using {column} as source.
php artisan slug:migration {table} command creates migration to add a slug column.
php artisan slug:reslug {table} {column} command creates or recreates slugs for a specified table.
Commands slug:auto and slug:reslug will recreate all slugs, even if they are already exist (forced reslug used).
Copyright
RussianSeoSlugs was written by Alexey Mezenin and released under the MIT License.
Alternatives to alexeymezenin/laravel-russian-slugs
Save time and get your Statamic site to rank better with the SEO addon for Stata...
SEO Helper is a framework agnostic package that provides tools & helpers for SEO...
Laravel package to allow you to easily integrate the Google Safebrowing API into...
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 0.9 | >=5.4.0 | MIT | ||
| 0.8.80 | >=5.4.0 | MIT | ||
| 0.8.79 | >=5.4.0 | MIT | ||
| 0.8.78 | >=5.4.0 | MIT | ||
| 0.8.77 | >=5.4.0 | MIT | ||
| 0.8.76 | >=5.4.0 | MIT | ||
| 0.8.75 | >=5.4.0 | MIT | ||
| 0.8.74 | >=5.4.0 | MIT | ||
| 0.8.73 | >=5.4.0 | MIT | ||
| 0.8.72 | >=5.4.0 | MIT | ||
| 0.8.71 | >=5.4.0 | MIT | ||
| 0.8.8 | >=5.4.0 | MIT | ||
| 0.8.7 | >=5.4.0 | MIT | ||
| 0.8.6 | >=5.4.0 | MIT | ||
| 0.8.5 | >=5.4.0 | MIT | ||
| 0.8.4 | >=5.4.0 | MIT | ||
| 0.8.3 | >=5.5 | ^5.0 | MIT | |
| 0.8.2 | >=5.4.0 | MIT | ||
| 0.8.1 | >=5.4.0 | MIT | ||
| 0.8 | >=5.4.0 | MIT | ||
| v0.7.1 | >=5.4.0 | MIT | ||
| 0.7 | >=5.4.0 | MIT |