PHP code example of cserobiul / slug
1. Go to this page and download the library: Download cserobiul/slug 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/ */
cserobiul / slug example snippets
use Cserobiul\Slug\Slug;
php artisan vendor:publish cserobiul/slug
// 1st time create slug
Slug::make('blogs', 'Blog Title', 'slug');
// Output: blog-title
// 2nd time create slug
Slug::make('blogs', 'Blog Title', 'slug');
// Output: blog-title-1
// 3rd time create slug
Slug::make('blogs', 'Blog Title', 'slug');
// Output: blog-title-2
// 4th time create slug
Slug::make('blogs', 'Blog Title', 'slug');
// Output: blog-title-3
// 1st time create slug
Slug::make('blogs', 'প্রেমের নাম বেদনা', 'slug');
// Output: প্রেমের-নাম-বেদনা
// 2nd time create slug
Slug::make('blogs', 'প্রেমের নাম বেদনা', 'slug');
// Output: প্রেমের-নাম-বেদনা-1
// 3rd time create slug
Slug::make('blogs', 'প্রেমের নাম বেদনা', 'slug');
// Output: প্রেমের-নাম-বেদনা-2
// 4th time create slug
Slug::make('blogs', 'প্রেমের নাম বেদনা', 'slug');
// Output: প্রেমের-নাম-বেদনা-3
// 1st time create customer username.
UniqueSlug::make('customers', 'jony', 'username', '_');
// Output: jony
// 2nd time create customer username.
UniqueSlug::make('customers', 'jony', 'username', '_');
// Output: jony_1
// 3rd time create customer username.
UniqueSlug::make('customers', 'jony', 'username', '_');
// Output: jony_2
// 4th time create customer username.
UniqueSlug::make('customers', 'jony', 'username', '_');
// Output: jony_3