- PHP 8.2 or higher
- Symfony 6.3 or higher
worker- The worker itself.worker:start- Starts a worker.worker:stop- Stop one or all workers.
# Start a worker
$ symfony console worker:start --id 1
# Stop a worker
$ symfony console worker:stop --id 1
# Stop all worker
$ symfony console worker:stop --allMake sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Open a command console, enter your project directory and execute:
composer require sourecode/worker-bundleOpen a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
composer require sourecode/worker-bundleThen, enable the bundle by adding it to the list of registered bundles
in the config/bundles.php file of your project:
// config/bundles.php
return [
// ...
\SoureCode\Bundle\Worker\SoureCodeWorkerBundle::class => ['all' => true],
];Add doctrine mapping to your config/packages/doctrine.yaml file:
doctrine:
orm:
mappings:
SoureCodeWorker:
is_bundle: false
type: attribute
dir: '%kernel.project_dir%/vendor/sourecode/worker-bundle/src/Entity'
prefix: 'SoureCode\Bundle\Worker\Entity'
alias: SoureCodeWorkerCreate a new migration with make:migration and execute it with doctrine:migrations:migrate.
$ symfony console make:migration
$ symfony console doctrine:migrations:migrateOr run just doctrine:schema:update if you don't want to use migrations or are still in development.
$ symfony console doctrine:schema:update --force