Parallel execution of #[Embed] resources for BEAR.Sunday.
#[Embed(rel: 'profile', src: 'app://self/user/profile?id={user_id}')]
#[Embed(rel: 'posts', src: 'app://self/user/posts?user_id={user_id}')]
#[Embed(rel: 'notifications', src: 'app://self/notifications?user_id={user_id}')]
public function onGet(int $user_id): staticThese three embeds run in parallel. The resource code does not change; you pick the execution mode at the application boundary.
composer require bear/async| Server | Requires | Application change |
|---|---|---|
| PHP-FPM / Apache | ZTS PHP + ext-parallel | add bin/async.php (see manual) |
| Swoole HTTP Server | ext-swoole / ext-openswoole | add a swoole context module that installs AsyncSwooleModule; boot on the compiled injector (see manual) |
Without either extension the same code runs sequentially. A missing extension
fails at configure() with ExtensionNotLoadedException; there is no silent
fallback.
- Manual: Parallel Resource Execution — setup, constraints, pool sizing, failure semantics, how it works (日本語)
- Demo guide — Docker-based demo for sequential, ext-parallel, and Swoole
- Benchmark results — cold CLI and steady-state HTTP measurements
- Parallel execution architecture
cd demo
docker compose up -d --wait parallel
docker compose exec parallel composer install
docker compose exec parallel composer app -- get 'app://self/dashboard?user_id=1'
docker compose exec parallel composer async -- get 'app://self/dashboard?user_id=1'PHP 8.2+. Each execution mode adds its own extension requirement (table above).