PHP code example of rajibbinalam / laravel-slug-generator

1. Go to this page and download the library: Download rajibbinalam/laravel-slug-generator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rajibbinalam / laravel-slug-generator example snippets


"providers": [
    Rajib\LaravelSlugGenerator\SlugGeneratorServiceProvider::class,
],

"aliases": {
    'SlugGenerator' => Rajib\LaravelSlugGenerator\Facades\SlugGenerator::class,
}

use Rajib\LaravelSlugGenerator\Facades\SlugGenerator;

//SlugGenerator::generate($model, '$title', '$db_field_name');
SlugGenerator::generate(User::class, 'Hello World', 'slug');

'separator' => '-',

'max_count' => '100',

SlugGenerator::generate(User::class, 'Hello World', 'slug');  // output: hello-world

SlugGenerator::generate(User::class, 'Hello World', 'slug');  // output: hello-world-1

SlugGenerator::generate(User::class, 'Hello World', 'slug');  // output: hello-world-2

SlugGenerator::generate(User::class, 'Hello World', 'slug');  // output: hello-world-3
sh
php artisan vendor:publish