DEV Community

Mohammed Samgan Khan
Mohammed Samgan Khan

Posted on

Slug Behavior for CakePHP 3.x, making slug management super easy

I created this behavior for CakePHP 3.x a long time ago. Managing slug manually is one hell of a work. This will take care of all the basic needs you have in a project with a slug.

Since behavior is automatically bound by the modal events, I am using before save event for all the management. It's super easy and can be customized as per need.

feel free to seek any assistance in case you feel need to do so.

Thanks

PS: in case wondering how to use it. Create a file with name SlugBehavior.php in /src/Model/Behavior/ of your project and add

$this->addBehavior('Slug');

to your modal in which you want you to use this behavior.

Top comments (0)