PHP code example of nash-ye / nslug
1. Go to this page and download the library: Download nash-ye/nslug 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/ */
nash-ye / nslug example snippets
use NSlug\SlugGenerator;
$options = [
'limit' => null,
'delimiter' => '-',
'lowercase' => true,
];
$slugGenerator = new SlugGenerator($options);
// English strings.
echo $slugGenerator->generate('Hello World'); // Prints 'hello-world'.
echo $slugGenerator->generate('Life is too short!'); // Prints 'life-is-too-short'.
// Arabic strings.
echo $slugGenerator->generate('صباح جميل'); // Prints 'صباح-جميل'.
echo $slugGenerator->generate('مساء الخير'); // Prints 'مساء-الخير'.