# The Fiber class

(PHP 8 >= 8.1.0)

## Introducción

Fibers represent full-stack, interruptible functions. Fibers may be suspended from anywhere in the call-stack, pausing execution within the fiber until the fiber is resumed at a later time.

## Sinopsis de la Clase

final class Fiber {
/* Métodos */
public __construct(callable `$callback`)
public start(mixed `...$args`): mixed
public resume(mixed `$value` = `null`): mixed
public throw(Throwable `$exception`): mixed
public getReturn(): mixed
public isStarted(): bool
public isSuspended(): bool
public isRunning(): bool
public isTerminated(): bool
public static suspend(mixed `$value` = `null`): mixed
public static getCurrent(): ?Fiber
}

## Ver también

Fibers overview

## Tabla de contenidos

- Fiber::__construct — Creates a new Fiber instance
- Fiber::start — Start execution of the fiber
- Fiber::resume — Resumes execution of the fiber with a value
- Fiber::throw — Resumes execution of the fiber with an exception
- Fiber::getReturn — Gets the value returned by the Fiber
- Fiber::isStarted — Determines if the fiber has started
- Fiber::isSuspended — Determines if the fiber is suspended
- Fiber::isRunning — Determines if the fiber is running
- Fiber::isTerminated — Determines if the fiber has terminated
- Fiber::suspend — Suspends execution of the current fiber
- Fiber::getCurrent — Gets the currently executing Fiber instance