PHP code example of marcohern / slugifier

1. Go to this page and download the library: Download marcohern/slugifier 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/ */

    

marcohern / slugifier example snippets


use Marcohern\Slugifier\Lib\Slugifier;

$slugifier = new Slugifier();

echo $slugifier->slugify('Death Stranding');
//output: death-stranding

$result = $slugifier->check('Death Stranding','Games');
/*
$result == [
  'entity' => 'games',
  'slug' => 'death-stranding',
  'sequence' => 0
]
*/

$result = $slugifier->store('Death Stranding','Games');
/* first time
$result == [
  'entity' => 'games',
  'slug' => 'death-stranding',
  'sequence' => 0
]
*/

$result = $slugifier->store('Death Stranding','Games');
/* second time
$result == [
  'entity' => 'games',
  'slug' => 'death-stranding-1',
  'sequence' => 1
]
*/
bash
$ php artisan migrate