arquivei / laravel-skeleton-worker
Base project for Command line Workers using Laravel.
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 17
Forks: 0
Open Issues: 0
Type:project
Requires
- php: ^8.1
- ext-rdkafka: ^5.0
- arquivei/events-sender: 3.2.1
- arquivei/laravel-health-checker: 2.2.0
- arquivei/laravel-prometheus-exporter: 2.0.0
- arquivei/log-adapter: 1.0.0
- arquivei/php-kafka-consumer: 2.3.1
- laravel/framework: 8.77.1
- spatie/data-transfer-object: 3.7.2
Requires (Dev)
- barryvdh/laravel-ide-helper: 2.10.0
- fakerphp/faker: 1.17.0
- mockery/mockery: 1.4.4
- nunomaduro/collision: 5.10.0
- phpstan/phpstan: 0.12.99
- phpstan/phpstan-phpunit: 1.0.0
- phpunit/phpunit: 9.5.11
- squizlabs/php_codesniffer: 4.0.x-dev
This package is auto-updated.
Last update: 2024-11-11 23:18:03 UTC
README
Base project for command line workers using Laravel
Requirements
- PHP 8.1+
- Composer
- Git
- Docker Engine 17.09.0+
- docker-composer 1.26+
Creating a new worker
composer create-project arquivei/laravel-skeleton-worker my-worker
or
docker run -it --rm -v $PWD:/app composer create-project arquivei/laravel-skeleton-worker my-worker
Edit .env
- APP_IDENTIFIER=
- COMPOSER_AUTH=
make setup sudo chmod -R 777 storage/
Usage
php artisan start:worker
About Example Producer
- Variables taken from .env file or class initialization options
- Will post in the topic:
- KAFKA_PREFIX + EVENTS_STREAM
- com.arquivei.stonks-events
About Example Consumer
- Variables taken from .env file or class initialization options
- Will consume from the queue:
- KAFKA_PREFIX + EVENTS_STREAM + 'topic'
- com.arquivei.stonks-events.example-app_example-event
Run Example Producer or Consumer
- Edit .env with kafka information
- With artisan run the command example:consumer then example:producer
Run Example Integration Tests
- Start docker compose with zookeeper, kafka and kafdrop:
docker-compose up
- Run tests: ProducerCommandtTest.php and ExampleConsumerTest.php
- Go to http://localhost:9090 to see topics created in local kafka