Archives

Categories

Tag: Cron

As part of a tool I am currently creating I needed a way to validate user supplied cron patterns.

Laravel has plenty of built in validators including regex which I could have used, however I found creating the required regex pattern was complicated – and ugly. I wanted to just be able to specify the rule in the model validation rules with something simple like “cron_expression”.

Instead of writing the regex patterns required to detect cron patterns I decided to use the brilliant cron expression library to do the validation for me – all of the validation is already done and any PHP project that is dealing with cron expressions should already be using this parser as it seems to be the best out there by far.