open-southeners / sidecar-local
An extension of Laravel Sidecar project to be able to use it locally with Docker
Fund package maintenance!
Requires
- php: ^8.2
- hammerstone/sidecar: dev-l13-compatibility
- illuminate/console: ^12.0 || ^13.0
- illuminate/filesystem: ^12.0 || ^13.0
- illuminate/support: ^12.0 || ^13.0
- symfony/yaml: ^6.3 || ^7.0
Requires (Dev)
- larastan/larastan: ^3.0
- orchestra/testbench: ^10.0 || ^11.0
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^11.0
README
An extension of Laravel Sidecar project to be able to use it locally with Docker.
Getting started
composer require open-southeners/sidecar-local
Setting up
Publish config file with the following command:
php artisan vendor:publish --provider="OpenSoutheners\\SidecarLocal\\ServiceProvider"
Then don't forget to set your sidecar.env config option to local and the sidecar.functions with the ones you want to test locally to make this work.
Run the following command to publish Docker Compose files into resources/sidecar with --run option to run Docker with all services locally:
php artisan sidecar:local --run
By default this starts a Docker-in-Docker daemon container and runs Traefik plus all Lambda runtime containers inside it. This keeps local Lambda containers isolated from the host Docker daemon while still exposing the local invoke endpoint on localhost:6000.
To stop the services you can just run the same but with --stop option:
php artisan sidecar:local --stop
Stopping uses a Sidecar-specific Compose project name and removes orphaned Sidecar function containers. It should not be run against your application's main Docker Compose or Sail stack.
Laravel Sail
Use --sail when running Sidecar Local from a Laravel Sail project:
php artisan sidecar:local --sail --run
Set SIDECAR_LOCAL_HOST=sidecar-docker when the Laravel application container needs to call the local Lambda endpoint through the DinD service. If your Sail network is not named sail, set SIDECAR_LOCAL_DOCKER_NETWORK to the actual external Docker network name.
Partners
License
This package is open-sourced software licensed under the MIT license.
