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, to have fewer than 50 already-published tasks, and the task'spublicConfig.inputSchemaFields/publicConfig.datasetViewto be set.start(mixed $input = null, ?TaskStartOptions $options = null): ActorRuncall(mixed $input = null, ?TaskStartOptions $options = null, ?int $waitSecs = null): ActorRungetInput(): mixed,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();