dunglas / frankenphp

🧟 The modern PHP app server
https://frankenphp.dev
MIT License
7.01k stars 245 forks source link

Allow a way to define scripts to be run regularly or as a service #987

Closed ochorocho closed 3 months ago

ochorocho commented 3 months ago

Describe you feature request

Given im using TYPO3 CMS ...

Describe the solution you'd like It would be great if we had a way to define scripts in the Caddyfile to run every X minutes defined like a CronJob. To use the message bus it would be great to allow frankenPHP to start the messege consumer and maintain the services state. (Maybe goroutine?)

Describe alternatives you've considered Well, its not a problem to set up the CronJob for the TYPO3 scheduler or add an addtitional service file to start the message consumer. But this will allow the user to restart a single service (FrankenPHP) and have all things in place.

Thank you :-)

dunglas commented 3 months ago

For Symfony messenger, you may be interested in these Caddy plugins: https://github.com/dunglas/frankenphp/issues/490#issuecomment-1902702199

For cron jobs, there was a plugin for Caddy 1, but it doesn't seem to be a similar package for Caddy 2. This should be easy to implement using the underlying Go library used by this module: https://github.com/robfig/cron or this one https://github.com/go-co-op/gocron.

Anyway, we want to keep FrankenPHP focused and we won't add these features in the core. Using 3rd-party Caddy modules is the way to go!

ochorocho commented 3 months ago

👍 OK, thanks for the quick response