Tasks are pre-configured Actor runs with stored input. Snippets assume
$client = new ApifyClient('my-api-token'); and imported types.
list(?ListOptions $options = null): PaginationListiterate(?ListOptions $options = null, ?int $chunkSize = null): iterable— lazily iterate all tasks, paging on demand. The options'limitcaps the total number yielded across all pages (unset = all);$chunkSizeis the per-page size.create(mixed $task): Task
$task = $client->tasks()->create([
'actId' => 'apify/hello-world',
'name' => 'my-task',
'input' => ['message' => 'hello'],
]);
foreach ($client->tasks()->iterate(new ListOptions(), 50) as $t) {
echo $t->getId() . PHP_EOL;
}get(): ?Task,update(mixed $newFields): Task,delete(): voidpublish(): Task,unpublish(): Task— publish/unpublish the task's public landing page, by settingisPublicthroughupdate(). Both require write permission to the task's Actor; publishing additionally requires the Actor to be public and the task'spublicConfig.inputSchemaFields/publicConfig.datasetViewto be set. An Actor can have up to 10 published tasks and an account up to 100; if the conditions aren't met, the request fails and nothing is changed.start(mixed $input = null, ?TaskStartOptions $options = null): ActorRun—$options->waitForResourcesretries a start the API rejects for lack of account resources; see the Actor docs'start()for the full behavior.call(mixed $input = null, ?TaskStartOptions $options = null, ?int $waitSecs = null): ActorRungetInput(): mixed(throws if the task itself does not exist — a 404 here cannot mean anything else),updateInput(mixed $input): mixedlastRun(?LastRunOptions $options = null): RunClientruns(): RunCollectionClientwebhooks(): NestedWebhookCollectionClient— read-only.
$run = $client->task('me~my-task')->call(['message' => 'override'], null, 120);
$input = $client->task('me~my-task')->getInput();
$client->task('me~my-task')->publish();