If you are using cakephp framework for your web application development. Sometimes you need to create SEO friendly url slug from your article / post / page / news etc title.
If a article title is “Article title to url slug with cakephp” then your SEO friendly url slug supposed to be “article-title-to-url-slug-with-cakephp”
To create this kinds of url slug from a string you can use cakephp core utility class Inflector, The Inflector takes a string and manipulate it to handle some common words variations.
To make slug from string using Inflector you can use below written code in your controller:
For your multiple use you can create a common method on your application controller like