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.
PS: in case wondering how to use it. Create a file with name SlugBehavior.php in /src/Model/Behavior/ of your project and add
to your modal in which you want you to use this behavior.