- What is huang-yi/shadowfax and what problem does it solve in Laravel?
- Shadowfax is a Laravel package that runs your application on the Swoole PHP extension instead of the traditional PHP-FPM model. Rather than bootstrapping the framework on every request, it boots the app once inside a Swoole worker and handles each incoming request in a coroutine that receives a sandboxed copy of the service container. It also ships a Guzzle-based API for issuing HTTP requests concurrently, so controller code that depends on several external services does not have to wait on each call sequentially.
- How do I install huang-yi/shadowfax in a Laravel application?
- Install it with Composer using composer require huang-yi/shadowfax, then register the package service provider if your Laravel version does not auto-discover it. Publish the package configuration file and start the server through the provided Artisan command rather than php artisan serve or your FPM pool. The prerequisite is the Swoole PECL extension, which must be compiled and enabled on the host before the artisan command will boot.
- Which Laravel, PHP, and Swoole versions does Shadowfax support?
- There is no published compatibility matrix, and the last tagged release is from January 2022, so support for Laravel majors released after that point is effectively unverified. Before adopting it, pin an explicit PHP, Swoole, and Laravel combination and run your full test suite under the Swoole runtime rather than only under PHP-FPM. Treat any version claim as something you must prove in CI for your own dependency set.
- Is huang-yi/shadowfax still maintained?
- The project appears effectively unmaintained: a single release in January 2022 with little activity since, and no clear signal that fixes are being merged. That matters because the package sits directly on the request lifecycle, where a stalled bug fix can block a Laravel upgrade. If you need a supported long-lived Swoole runtime, Laravel Octane is the maintained first-party option.
- Shadowfax vs Laravel Octane: which should I choose?
- Both use the same fundamental model: an application booted once per worker, with each request handled in a coroutine against a sandboxed container copy. Octane is first-party, supports Swoole alongside RoadRunner and FrankenPHP, and tracks new Laravel releases, whereas Shadowfax is a competing implementation that has not kept pace. Unless you have a concrete requirement Octane cannot satisfy, prefer Octane on maintenance and support grounds, and benchmark only if you suspect a meaningful throughput difference.
- Can Shadowfax send multiple HTTP requests in parallel?
- Yes. The package wraps Guzzle with a simplified API for dispatching several outbound requests concurrently and collecting the responses afterward, which cuts wall-clock time for endpoints that fan out to multiple external services. Keep in mind that concurrency helpers such as Laravel's own HTTP client pool cover the same need without changing your runtime. The parallel-request feature is only worth the Swoole dependency if you also want the persistent-worker server model.
- Is Shadowfax safe for stateful apps, or can state leak between concurrent requests?
- Safety depends entirely on your application, not on the package. Request-scoped singletons, static or global state, shared PDO connections, and extensions that are not coroutine-safe can bleed data across concurrent requests, which is both a correctness defect and a data-exposure risk. Stateless JSON and API services fit well; apps with heavy session handling, file uploads, or a long tail of unmaintained libraries fit poorly and require a dependency audit before anything else.
- Do I need the Swoole extension, and will my hosting support it?
- Yes, Swoole is a PECL extension and must be installed and enabled on every host that runs the worker. Compiling it requires build tooling, and some managed hosts and PaaS platforms disallow custom PHP extensions entirely. Confirm infrastructure support before you invest in the integration, since this constraint alone can rule the package out.
- How should I test and roll out Shadowfax in production?
- Treat it as a parallel runtime rather than a big-bang cutover. Run the identical application under PHP-FPM and under Shadowfax behind the same load balancer, canary a small traffic slice, and compare p50 and p99 latency, error rate, and per-worker memory against a fixed baseline, including a multi-hour soak test for leaks. Keep FPM warm as a fallback so rollback is a routing change rather than a redeploy, and remember that coroutine stacks complicate APM, tracing, and Xdebug-based debugging.
- Does Shadowfax change how queue workers, the scheduler, and migrations run?
- Those CLI paths run outside the Swoole server and normally stay on the standard Laravel bootstrap, so they are typically untouched by the package. It is still worth confirming explicitly in staging that your queue workers, scheduled tasks, and migrations behave identically, since they may share configuration with the server process. Also verify that your session, cache, and database drivers are coroutine-safe before sending production traffic.