A task is an Actor run with a 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 yields the tasks. Thelimitoption caps the total (unset for all),$chunkSizeis the 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 or unpublish the public landing page by settingisPublic. Both need write permission to the Actor of the task. Publishing also needs a public Actor and thepublicConfig.inputSchemaFieldsandpublicConfig.datasetViewof the task. An Actor can have 10 published tasks and an account 100. If a condition fails, nothing changes.start(mixed $input = null, ?TaskStartOptions $options = null): ActorRun:$options->waitForResourcesis as forActorClient::start().call(mixed $input = null, ?TaskStartOptions $options = null, ?int $waitSecs = null, int|float|string|null $timeoutSecs = null): ActorRungetInput(): mixed(throws if the task does not exist),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();