Generate url friendly slugs in Laravel

We can use the built in string slug function in Laravel to generate SEO friendly urls.

Str::slug("1/2 wouldn't be half!");

The output would be

"12-wouldnt-be-half"

Enjoyed this post? Share it!