This package allows you to use Google Cloud Scheduler to schedule Laravel commands.
It only supports Artisan commands at this time due to security concerns.
Cloud Tasks will make a HTTP call to your application. This package adds an endpoint to your application that accepts the HTTP call and its payload (an Artisan command) and executes the command.
This package requires Laravel 5.6 or higher.
Please check the table below for supported Laravel and PHP versions:
|Laravel Version||PHP Version|
|5.6||7.2 or 7.3|
|5.7||7.2 or 7.3|
|5.8||7.2 or 7.3 or 7.4|
|6.x||7.2 or 7.3 or 7.4|
|7.x||7.2 or 7.3 or 7.4|
(1) Require the package using Composer
composer require stackkit/laravel-google-cloud-scheduler
(2) Define the
STACKKIT_CLOUD_SCHEDULER_APP_URL environment variable. This should be the URL defined in the
URL field of your Cloud Scheduler job.
Here is an example job that will run
php artisan inspire every minute.
These are the most important settings:
- Target must be
- URL must be
- Auth header must be OIDC token!
Laravel's console kernel allows to execute actions after the command has finished running (such as ping a service) and prevent overlapping. This package does not support those features at this time. The goal is to eventually read the configured settings for a command (as defined in the console kernel) and execute the command exacty as defined there so that methods like
withoutOverlapping work out of the box without the need to configure anything.
The job handler requires each request to have an OpenID token. Cloud Scheduler will generate an OpenID token and send it along with the job payload to the handler.
This package verifies that the token is digitally signed by Google and that it's meant for your application. Only Google Scheduler will be able to call your handler.
More information about OpenID Connect: