Download the PHP package venndev/vosaka-fourotines without Composer

On this page you can find all versions of the php package venndev/vosaka-fourotines. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package vosaka-fourotines

VOsaka Foroutines

A PHP library for structured asynchronous programming using foroutines (fiber + coroutines), inspired by Kotlin coroutines. This is project with the contribution of a project from php-async

πŸ“š Documentation

New to VOsaka Foroutines? Check out our Structured Documentation (following the DiΓ‘taxis framework), which includes:

Architecture

Features

Core β€” RunBlocking, Launch, Async, Async::awaitAll(), Delay, Repeat, WithTimeout, Job lifecycle

Dispatchers β€” DEFAULT (fibers + AsyncIO), IO (child process via WorkerPool), MAIN (event loop)

WorkerPool β€” Pre-spawned long-lived worker processes with task batching, dynamic pool sizing, and respawn backoff

FiberPool β€” Reusable Fiber instances for scheduler optimization (default: 10, dynamic sizing)

Channel β€” Four transports: in-process, socket pool (default), socket per-channel, file-based

AsyncIO β€” Non-blocking stream I/O via stream_select() (TCP, TLS, HTTP, files, DNS)

Flow β€” Cold Flow, SharedFlow, StateFlow with backpressure (SUSPEND, DROP_OLDEST, DROP_LATEST, ERROR)

Actor Model β€” Message-passing concurrency with Channel-based mailboxes and ActorSystem registry

Supervisor Tree β€” OTP-style supervision with ONE_FOR_ONE, ONE_FOR_ALL, REST_FOR_ONE strategies

Sync β€” Mutex (file, semaphore, APCu), Select for channel multiplexing

Rules

Rules

Requirements

Optional Extension Purpose
ext-pcntl Low-overhead IO dispatch via pcntl_fork() (~1-5ms vs ~50-200ms)
ext-sysvsem Semaphore-based Mutex
ext-apcu APCu-based Mutex

Installation

Usage

All entry points must be wrapped in main() or use the #[AsyncMain] attribute:

RunBlocking + Launch

Async / Await

Async::awaitAll β€” Concurrent Awaiting

awaitAll() drives multiple async tasks forward simultaneously, returning all results in order. This is significantly more efficient than awaiting sequentially.

WithTimeout

Job Lifecycle

Channel

Mode Factory Use Case
In-process Channel::new(capacity) Fibers in the same process
Socket pool (default) Channel::create(capacity) IPC via shared ChannelBrokerPool
Socket per-channel Channel::newSocketInterProcess(name, capacity) Legacy β€” 1 process per channel
File-based Channel::newInterProcess(name, capacity) IPC via temp file + mutex

Non-blocking operations:

Channels utility class:

Select

Flow

AsyncIO β€” Non-blocking Stream I/O

All methods return Deferred β€” a lazy wrapper that executes on ->await():

Method Returns Description
tcpConnect(host, port)->await() resource Non-blocking TCP connection
tlsConnect(host, port)->await() resource Non-blocking TLS/SSL connection
streamRead(stream, maxBytes)->await() string Read up to N bytes
streamReadAll(stream)->await() string Read until EOF
streamWrite(stream, data)->await() int Write data
httpGet(url)->await() string HTTP GET
httpPost(url, body)->await() string HTTP POST
fileGetContents(path)->await() string Read entire file
filePutContents(path, data)->await() int Write file
dnsResolve(hostname)->await() string Resolve hostname to IP

Mutex

Dispatchers

Dispatcher Description
DEFAULT Runs in the current fiber context (+ AsyncIO for non-blocking streams)
IO Offloads to a worker process via WorkerPool
MAIN Schedules on the main event loop

Thread::await()

While RunBlocking automatically drains all pending tasks before returning, Thread::await() allows you to manually block and drive the event loop until all work (Launch jobs, WorkerPool tasks, and AsyncIO) is finished.

When do you need it?

WorkerPool

A pool of pre-spawned long-lived child processes. On Linux/macOS uses pcntl_fork() + Unix socket pairs; on Windows uses proc_open() + TCP loopback sockets.

Task Batching

When many small tasks are submitted, IPC round-trip overhead dominates. Task batching groups multiple tasks into a single message sent to each worker, dramatically reducing round-trips.

Batch Size Behavior
1 (default) Original single-task protocol β€” lowest latency per task
5–10 Good balance for many small/fast tasks
20–50 Maximum throughput for trivial tasks

Batching is fully backward compatible β€” when batchSize=1, the pool uses the original TASK:/RESULT: protocol.

Dynamic Pool Sizing

The pool can automatically scale between a minimum and maximum number of workers based on workload pressure.

Scale-up: When all workers are busy and tasks are queued, a new worker is spawned (up to maxPoolSize).

Scale-down: When a worker has been idle longer than idleTimeout and the pool exceeds minPoolSize, it is shut down.

When dynamic scaling is disabled (default), the pool behaves exactly as before β€” a fixed number of workers.

Worker Respawn Backoff

When a worker crashes repetitively, respawning uses exponential backoff (100ms β†’ 200ms β†’ … max 30s) to prevent CPU spin. After 10 consecutive failures, the worker slot is removed (circuit-breaker).

FiberPool

Reusable Fiber instances to reduce allocation overhead. Integrated into Launch, Async, RunBlocking.

Actor Model

Supervisor Tree

OTP-style supervision with automatic restart on child failure.

Strategy Behavior
ONE_FOR_ONE Restart only the crashed child
ONE_FOR_ALL Restart all children
REST_FOR_ONE Restart crashed child + all started after it

ForkProcess

On Linux/macOS, ForkProcess creates child processes by forking the current process instead of spawning a new interpreter:

Strategy Overhead Closure Serialization
ForkProcess (pcntl_fork) ~1-5ms Not needed (memory copied)
Process (symfony/process) ~50-200ms Required

Selection is automatic β€” Worker uses fork when available, falls back to symfony/process on Windows.

Platform Support

Feature Linux/macOS Windows
Fibers (core) βœ… βœ…
FiberPool βœ… βœ…
AsyncIO (stream_select) βœ… βœ…
Channel (all transports) βœ… βœ…
Actor Model βœ… βœ…
Supervisor Tree βœ… βœ…
WorkerPool (fork mode) βœ… ❌ (uses socket mode)
WorkerPool (socket mode) βœ… βœ…
ForkProcess (pcntl_fork) βœ… ❌ (fallback to symfony/process)
Mutex (file lock) βœ… βœ…
Mutex (semaphore) βœ… (ext-sysvsem) ❌
Mutex (APCu) βœ… (ext-apcu) βœ… (ext-apcu)

Comparison with JavaScript Async

Aspect Node.js VOsaka Foroutines
Runtime libuv event loop (C) PHP Fibers + stream_select
I/O model Non-blocking by default AsyncIO for streams; Dispatchers::IO for blocking APIs
Concurrency Single-threaded + worker threads Single process + child processes (fork/spawn)
Syntax async/await (language-level) Async::new()->await() / Async::awaitAll() (library-level)
Worker pool worker_threads WorkerPool with task batching + dynamic scaling
IPC channels MessagePort Channel::create() (shared TCP pool)
Flow control Node.js Streams BackpressureStrategy (SUSPEND/DROP/ERROR)

License

GNU Lesser General Public License v2.1


All versions of vosaka-fourotines with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
symfony/process Version ^7.3
laravel/serializable-closure Version ^2.0
ext-shmop Version *
ext-fileinfo Version *
ext-zlib Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package venndev/vosaka-fourotines contains the following files

Loading the files please wait ...