Installation
composer require bbit/base-bundle
Add to config/bundles.php:
return [
// ...
BranchBit\BaseBundle\BranchBitBaseBundle::class => ['all' => true],
];
First Use Case: Async Job Dispatch
Create a command class (e.g., app/Commands/ProcessUser.php):
namespace App\Commands;
use BranchBit\AsyncDispatcherBundle\Command\CommandInterface;
class ProcessUser implements CommandInterface {
public function execute() {
// Your logic here
}
}
Dispatch it in a controller/service:
use BranchBit\AsyncDispatcherBundle\Dispatcher\CommandDispatcher;
$dispatcher = app(CommandDispatcher::class);
$dispatcher->dispatch(new ProcessUser());
Doctrine Extensions
Enable in config/packages/doctrine.yaml:
doctrine:
orm:
mappings:
gedmo_timestampable: ~
Add Gedmo\Timestampable\TimestampableEntity to your entities.
SqsCommandQueueBundle for SQS-backed async jobs.
Configure in config/packages/branchbit_base.yaml:
branchbit_base:
async_dispatcher:
queue: 'your_sqs_queue_url'
CommandInterface with execute() and onFailure():
public function onFailure(\Exception $e) {
// Custom retry logic
}
Gedmo\SoftDeleteable\SoftDeleteableTrait to entities.
use Gedmo\SoftDeleteable\SoftDeleteableTrait;
class User implements SoftDeleteable {
use SoftDeleteableTrait;
}
@ORM\PrePersist/@ORM\PostUpdate annotations.app():
$queue = app(\BranchBit\SqsCommandQueueBundle\Queue\SqsQueue::class);
php bin/console branchbit:async:list (if CLI commands exist).doctrine/doctrine-bundle is installed and configured.async_dispatcher.yaml for SQS credentials).doctrine/doctrine-extensions as a dependency (install manually if not auto-resolved).BranchBit\AsyncDispatcherBundle\Command\AbstractCommand for shared logic.SqsQueue to support other providers (e.g., RabbitMQ).branchbit:* commands).composer.json).How can I help you explore Laravel packages today?