precision-soft / symfony-console
symfony console utilities
v1.2.0
2024-11-05 13:43 UTC
Requires
- php: >=8.2
- symfony/config: 7.*
- symfony/console: 7.*
- symfony/dependency-injection: 7.*
- symfony/filesystem: 7.*
- symfony/http-kernel: 7.*
Requires (Dev)
README
You may fork and modify it as you wish.
Any suggestions are welcomed.
Config example
precision_soft_symfony_console.yaml
precision_soft_symfony_console:
cron:
config:
template_class: \PrecisionSoft\Symfony\Console\Template\CrontabTemplate
conf_files_dir: '%kernel.project_dir%/generated_conf/cron'
logs_dir: '%kernel.logs_dir%/cron'
log: true
destination_file: 'crontab'
heartbeat: true
commands:
list:
command: '%kernel.project_dir%/bin/console list'
schedule:
minute: '*'
hour: '*'
day_of_month: '*'
month: '*'
day_of_week: '*'
log: false
worker:
config:
template_class: \PrecisionSoft\Symfony\Console\Template\SupervisorTemplate
conf_files_dir: '%kernel.project_dir%/generated_conf/worker'
logs_dir: '%kernel.logs_dir%/worker'
number_of_processes: 1
auto_start: true
auto_restart: true
prefix: 'app-name'
user: 'root'
commands:
list:
command: '%kernel.project_dir%/bin/console list'
number_of_processes: 2
If the precision_soft_symfony_console.cronjob.config.heartbeat a command with the name heartbeat
will automatically be added, if not added by you.
For custom templates
Create a template service to implement PrecisionSoft\Symfony\Console\Contract\TemplateInterface and add to your services.yaml this config:
services:
_instanceof:
PrecisionSoft\Symfony\Console\Contract\TemplateInterface:
tags: [ 'precision-soft.symfony.console.template' ]
Dev
git clone git@gitlab.com:precision-soft-open-source/symfony/console.git
cd console
./dc build && ./dc up -d