2017 © Pedro Peláez
 

library laravel-russian-slugs

Russian SEO friendly slugs for Laravel 5

image

alexeymezenin/laravel-russian-slugs

Russian SEO friendly slugs for Laravel 5

  • Friday, October 13, 2017
  • by alexeymezenin
  • Repository
  • 3 Watchers
  • 16 Stars
  • 367 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 23 Versions
  • 7 % Grown

The README.md

The package is not supported anymore, (*1)

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., (*2)

, (*3)

Installation

Start with editing your Laravel project's composer.json file, add this line to the require section:, (*4)

"require": {
    ....
    "alexeymezenin/laravel-russian-slugs": "0.9.*"

After that run this command to install package:, (*5)

composer update

Now, insert these two lines into provider and aliases arrays in config/app.php:, (*6)

'providers' => [
    ....
    AlexeyMezenin\LaravelRussianSlugs\SlugsServiceProvider::class,


'aliases' => [
    ....
    'Slug' => AlexeyMezenin\LaravelRussianSlugs\SlugsFacade::class,

Finally, you need to register config file and slugs-related commands by running:, (*7)

php artisan vendor:publish

, (*8)

Using slugs

To use package, you need to update your models with thisuse clause:, (*9)

class Articles extends Model
{
    use \AlexeyMezenin\LaravelRussianSlugs\SlugsTrait;

Then you need to create slug column in a migration:, (*10)

$table->string('slug');

To use auto slug creation feature add slugFrom property to your model:, (*11)

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:, (*12)

$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., (*13)

, (*14)

Manual slug creation

To create new record with a slug use reslug() method. This will add slug, based on name column:, (*15)

$article = new Article;
$article->name = 'How to grow a tree?';
$article->reslug('name');
$article->save();

You can update existing record and add a slug:, (*16)

$article = Article::find(1);
$article->reslug('name');
$article->save();

If slug already exists, but you need to recreate it, use forced reslug:, (*17)

$article->reslug('name', true);

Alternatively, you can use Slug facade to manually work with slugs:, (*18)

$article = Article::find(1);
$article->update([
    'slug' => Slug::build($article->name)
    ]);

findBySlug() method allows you to find a model by it's slug:, (*19)

$slug = 'how-to-grow-a-tree';
$article = Article::findBySlug($slug);
echo $article->name; // Will output "How to grow a tree?"

, (*20)

Configuration

To configure a package you should edit config/seoslugs.php file., (*21)

delimiter is a symbol which replaces all spaces in a string. By default it's '_', but also can be '-'., (*22)

urlType is a type of slug:, (*23)

Default is 1. Used for URLs like /категория/книги_в_москве, (*24)

2 is for traslitterated URLs like /kategoriya/knigi_v_moskve, Yandex rules used to transliterate URL., (*25)

keepCapitals is false by default. When true it keeps capital letters in a slug, for example: /книги_в_Москве, (*26)

slugColumnName sets the name of a slug column. slug by default., (*27)

, (*28)

Commands

There are three console commands available in the package:, (*29)

php artisan slug:auto {table} {column} command creates and executes migration, reslugs a table (creates slugs for all rows) using {column} as source., (*30)

php artisan slug:migration {table} command creates migration to add a slug column., (*31)

php artisan slug:reslug {table} {column} command creates or recreates slugs for a specified table., (*32)

Commands slug:auto and slug:reslug will recreate all slugs, even if they are already exist (forced reslug used)., (*33)

RussianSeoSlugs was written by Alexey Mezenin and released under the MIT License., (*34)

The Versions

13/10 2017

dev-master

9999999-dev

Russian SEO friendly slugs for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

url google seo russian translit yandex cyrillic slugs

27/04 2016

0.9

0.9.0.0

Russian SEO friendly slugs for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

url google seo russian translit yandex cyrillic slugs

27/04 2016

0.8.80

0.8.80.0

Russian SEO friendly slugs for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

url google seo russian translit yandex cyrillic slugs

27/04 2016

0.8.79

0.8.79.0

Russian SEO friendly slugs for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

url google seo russian translit yandex cyrillic slugs

27/04 2016

0.8.78

0.8.78.0

Russian SEO friendly slugs for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

url google seo russian translit yandex cyrillic slugs

27/04 2016

0.8.77

0.8.77.0

Russian SEO friendly slugs for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

url google seo russian translit yandex cyrillic slugs

27/04 2016

0.8.8

0.8.8.0

Russian SEO friendly slugs for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

url google seo russian translit yandex cyrillic slugs

24/04 2016

0.8.76

0.8.76.0

Russian SEO friendly slugs for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

url google seo russian translit yandex cyrillic slugs

24/04 2016

0.8.75

0.8.75.0

Russian SEO friendly slugs for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

url google seo russian translit yandex cyrillic slugs

24/04 2016

0.8.74

0.8.74.0

Russian SEO friendly slugs for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

url google seo russian translit yandex cyrillic slugs

24/04 2016

0.8.73

0.8.73.0

Russian SEO friendly slugs for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

url google seo russian translit yandex cyrillic slugs

23/04 2016

0.8.72

0.8.72.0

Russian SEO friendly slugs for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

url google seo russian translit yandex cyrillic slugs

23/04 2016

0.8.71

0.8.71.0

Russian SEO friendly slugs for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

url google seo russian translit yandex cyrillic slugs

23/04 2016

0.8.7

0.8.7.0

Russian SEO friendly slugs for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

url google seo russian translit yandex cyrillic slugs

17/04 2016

0.8.6

0.8.6.0

Russian SEO friendly slugs for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

url google seo russian translit yandex cyrillic slugs

15/04 2016

0.8.5

0.8.5.0

Russian SEO friendly slugs

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

url google seo russian translit yandex cyrillic slugs

13/04 2016

0.8.4

0.8.4.0

Russian SEO friendly slugs

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

05/04 2016

0.8.3

0.8.3.0

Russian SEO friendly slugs

  Sources   Download

MIT

The Requires

 

by Alexey Mezenin

laravel url google seo russian yandex cyrillic slug

05/04 2016

0.8.1

0.8.1.0

Russian SEO friendly slugs

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

laravel url google seo russian yandex cyrillic slug

05/04 2016

0.8.2

0.8.2.0

Russian SEO friendly slugs

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

laravel url google seo russian yandex cyrillic slug

04/04 2016

v0.7.1

0.7.1.0

Russian SEO friendly slugs

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

laravel url google seo russian yandex cyrillic slug

04/04 2016

0.8

0.8.0.0

Russian SEO friendly slugs

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin

laravel url google seo russian yandex cyrillic slug

04/04 2016

0.7

0.7.0.0

Russian SEO friendly slugs

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexey Mezenin