An extension of Laravel Sidecar project to be able to use it locally with Docker.
composer require open-southeners/sidecar-localPublish 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 --runBy 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 --stopStopping 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.
Use --sail when running Sidecar Local from a Laravel Sail project:
php artisan sidecar:local --sail --runSet 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.
This package is open-sourced software licensed under the MIT license.
