Downloads
Stars
Version
https://github.com/honey-comb/slugs
Slugs manager for HoneyComb CMS
This is part core package HoneyComb CMS package.
If you want to use laravel version 5.5.* use slug package version 0.1.*
^7.1
^5.6
Begin by installing this package through Composer.
{
"require": {
"honey-comb/slugs": "0.2.*"
}
}
or
composer require honey-comb/slugs
generateHCSlug(string $path, string $string, string $separator = '-')
It is a helper function, which requires few parameters:
$path
- Under which domain the slug will be generated.
$string
- Source from which text the slug will be generated.
$separator
- You can specify a custom separator
Let's say we have 2 services House
and Flat
. Each of them will have a record with at title One
. And both of them will require a slug.
$houseSlug = generateHCSlug('house', 'One'); // output: one
$flatSlug = generateHCSlug('flat', 'One'); // output: one
Only when we will call it with the same name few times, then it will kick in.
$flatSlug = generateHCSlug('flat', 'One'); // output: one
$flatSlug = generateHCSlug('flat', 'One'); // output: one-1
$flatSlug = generateHCSlug('flat', 'One'); // output: one-2