Download the PHP package stackkit/laravel-google-cloud-tasks-queue without Composer

On this page you can find all versions of the php package stackkit/laravel-google-cloud-tasks-queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-google-cloud-tasks-queue

Cloud Tasks queue driver for Laravel

Run tests Latest Stable Version Downloads

This package allows Google Cloud Tasks to be used as the queue driver.

Companion packages: Cloud Scheduler, Cloud Logging

Image

Requirements

This package requires Laravel 11 or 12.

Installation

Require the package using Composer

Add a new queue connection to config/queue.php

Finally, set the correct environment variables.

If you're using Cloud Run:

If you're using App Engine:

Please check the table below on what the values mean and what their value should be.

Environment variable Description Example
CLOUD_TASKS_PROJECT The project your queue belongs to. my-project
CLOUD_TASKS_LOCATION The region where the project is hosted. europe-west6
CLOUD_TASKS_QUEUE The default queue a job will be added to. emails
App Engine
APP_ENGINE_TASK (optional) Set to true to use App Engine task (else a Http task will be used). Defaults to false. true
APP_ENGINE_SERVICE (optional) The App Engine service to handle the task (only if using App Engine task). api
Non- App Engine apps
CLOUD_TASKS_SERVICE_EMAIL (optional) The email address of the service account. Important, it should have the correct roles. See the section below which roles. [email protected]
CLOUD_TASKS_HANDLER (optional) The URL that Cloud Tasks will call to process a job. This should be the URL to your Laravel app. By default we will use the URL that dispatched the job. https://<your website>.com

Optionally, you may publish the config file:

If you are using separate services for dispatching and handling tasks, and your application only dispatches jobs and should not be able to handle jobs, you may disable the task handler from config/cloud-tasks.php:

How to

Passing headers to a task

You can pass headers to a task by using the setTaskHeadersUsing method on the CloudTasksQueue class.

If necessary, the current payload being dispatched is also available:

Configure task handler url

You can set the handler url for a task by using the configureHandlerUrlUsing method on the CloudTasksQueue class.

If necessary, the current job being dispatched is also available:

Configure worker options

You can configure worker options by using the configureWorkerOptionsUsing method on the CloudTasksQueue class.

Use a custom credentials file

Modify (or add) the client_options key in the config/cloud-tasks.php file:

Modify CloudTasksClient options

Modify (or add) the client_options key in the config/cloud-tasks.php file:

How it works and differences

Using Cloud Tasks as a Laravel queue driver is fundamentally different than other Laravel queue drivers, like Redis.

Typically a Laravel queue has a worker that listens to incoming jobs using the queue:work / queue:listen command. With Cloud Tasks, this is not the case. Instead, Cloud Tasks will schedule the job for you and make an HTTP request to your application with the job payload. There is no need to run a queue:work/listen command.

Good to know

Cloud Tasks has it's own retry configuration options: maximum number of attempts, retry duration, min/max backoff and max doublings. All of these options are ignored by this package. Instead, you may configure max attempts, retry duration and backoff strategy right from Laravel.

Authentication

If you're not using your master service account (which has all abilities), you must add the following roles to make it works:

  1. App Engine Viewer
  2. Cloud Tasks Enqueuer
  3. Cloud Tasks Viewer
  4. Cloud Tasks Task Deleter
  5. Service Account User

Upgrading

Read UPGRADING.MD on how to update versions.

Troubleshooting

HttpRequest.url must start with 'https://'

This can happen when your application runs behind a reverse proxy. To fix this, add the application domain to Laravel's trusted proxies. You may need to add the wildcard * as trusted proxy.

Maximum call stack size (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion?

This currently seems to be a bug with PHP 8.3 and googleapis/gax-php. See this issue for more information.

A potential workaround is to disable PHP 8.3 call stack limit by setting this value in php.ini:

Contributing

You can use the services defined in docker-compose.yml to start running the package.

Inside the container, run composer install.

Set up the environment: cp .env.example .env

Some tests hit the Cloud Tasks API and need a project and key to be able to hit it. See the variables in .env


All versions of laravel-google-cloud-tasks-queue with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
google/cloud-tasks Version ^2.0
thecodingmachine/safe Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package stackkit/laravel-google-cloud-tasks-queue contains the following files

Loading the files please wait ....