PHP 5 has reached end of support and will be deprecated on January 31, 2026. After deprecation, you won't be able to deploy PHP 5 applications, even if your organization previously used an organization policy to re-enable deployments of legacy runtimes. Your existing PHP 5 applications will continue to run and receive traffic after their deprecation date. We recommend that you migrate to the latest supported version of PHP.

A PHP Task Queue Example

The following code creates a task that will be sent as a POST request to the /worker handler of the application. The task contains name and action data, and will be processed by the default queue:

$task = new PushTask(
 '/worker',
 ['name' => 'john doe', 'action' => 'send_reminder']);
$task_name = $task->add();

You can also add tasks in bulk to a queue using PushQueue. In the following example, two PushTask objects are added to a PushQueue using the addTasks() method.

$task1 = new PushTask('/someUrl');
$task2 = new PushTask('/someOtherUrl');
$queue = new PushQueue();
$queue->addTasks([$task1, $task2]);

When you use PushTask and PushQueue, include these statements at the top of your PHP file:

use google\appengine\api\taskqueue\PushTask;
use google\appengine\api\taskqueue\PushQueue;

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年12月17日 UTC.