CodeIgniter Slug Generator Library
$this->load->library('slugify');
$text = 'This text will be slug!';
$slug = $this->slugify->slug($text);
echo $slug;
$title = 'Page Title which is going to be a slug';
$slug = $this->slugify->slug_unique($title, 'posts_table', 'slug');
It generates a new unique slug. If same slug exists, it will append a numeric value to the slug. Ex:
- about-us
- about-us-1
- about-us-2
- ...
- about-us-999
- etc...
$post_id = 10;
$title = 'Page Title which is going to be a slug';
$slug = $this->slugify->slug_unique($title, 'posts_table', 'slug', $post_id);
It generates a new unique slug. It excludes from self row...