honey-comb / slugs
HoneyComb slugs
Installs: 3 359
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: ^7.1
- honey-comb/core: 0.3.*
- honey-comb/starter: 0.2.*
- laravel/framework: 5.6.*
Requires (Dev)
- codedungeon/phpunit-result-printer: ^0.14
- mockery/mockery: ^1.0
- orchestra/testbench-browser-kit: ^3.6
- phpunit/phpunit: ~7.0
This package is auto-updated.
Last update: 2024-11-08 22:34:07 UTC
README
https://github.com/honey-comb/slugs
Description
Slugs manager for HoneyComb CMS
Attention
This is part core package HoneyComb CMS package.
If you want to use laravel version 5.5.* use slug package version 0.1.*
Requirement
- php:
^7.1
- laravel:
^5.6
- composer
Installation
Begin by installing this package through Composer.
{ "require": { "honey-comb/slugs": "0.2.*" } }
or
composer require honey-comb/slugs
Usage
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
Examples
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