Sidecar comes with a few CLI commands to make your life easier.
The install command publishes your sidecar.php
configuration file. Once that file is published, you will no longer see it in your list of available commands.
php artisan sidecar:install
The configure command is an interactive command that walks you through setting up your AWS credentials. Dealing with AWS IAM can be a pain, so we wrote this command to do it for you.
php artisan sidecar:configure
The make command will create a new function class in your app/Sidecar
directory.
php artisan make:lambda-function MyFunction
You can also pass a --runtime=
flag to specify the runtime you want to use. The default runtime for newly created functions is nodejs20.x
.
To see a list of available runtimes, see the Runtime section.
php artisan make:lambda-function MyFunction --runtime=python3.10
The deploy command deploys your functions to Lambda, and can optionally activate them.
To deploy but not activate, run the command without any arguments.
php artisan sidecar:deploy
This will create your Lambda function but Sidecar will not use this version until you activate it. This give you time to deploy your entire application and flip the switch at the very end. To read more about this, see the Deploying vs Activating section.
If you want to deploy and activate, you can pass the --activate
flag.
php artisan sidecar:deploy --activate
The activate command will activate the latest version of all of your functions to be used by Sidecar.
php artisan sidecar:activate
If you need to deploy an environment other than the one you are running in, you can override the environment from the config by passing an --env
flag to the Deploy and Activate commands.
php artisan sidecar:deploy --env=production
php artisan sidecar:activate --env=production