swoole/ide-helper
Fully documented IDE stub files for the Swoole PHP extension, giving PhpStorm and VS Code accurate autocompletion, parameter hints, and inline docs for every class, method, function, and constant. Install as a dev dependency and match the version to your Swoole release.
Architecture fit: conditional, and deliberately narrow. swoole/ide-helper is not a library in any architectural sense — it is a set of PHP stub files describing an extension implemented in C/C++, with no autoloading, no executable logic, and no runtime footprint. Its fit is entirely determined by one binary question: does any environment in our stack actually execute under Swoole? That means a Swoole HTTP/WebSocket server, coroutine workers, Hyperf, or Laravel Octane running the Swoole driver. On a conventional Laravel deployment (PHP-FPM, RoadRunner, or FrankenPHP), the correct TPM decision is to decline the package outright — it would add a dependency for zero benefit. Where Swoole is present, the fit is clean and the package is effectively mandatory tooling: without it, the IDE cannot see the extension's classes at all, so every Swoole\* or Co\* reference is an "undefined class" warning and every method call is untyped and unhinted.
Integration feasibility: very high, with near-zero cost. One composer command as a dev dependency; no service provider, no config publish, no bootstrap change, no CI modification, no container change. PhpStorm and VS Code with Intelephense index vendor/ automatically and immediately surface completion, parameter names, native type declarations, and inline PHPDoc. The only substantive work items are (a) aligning the stub release with the installed extension version and (b) one manual IDE setting per workstation. This should be governed as developer tooling — the same category as barryvdh/laravel-ide-helper — not routed through architecture review. Apache-2.0, zero executable code, so the dependency review is a formality.
Technical risk: low, and almost exclusively developer-experience risk. The package cannot break a build, a test run, or a deployment, because nothing loads it. That is the important framing for stakeholders: the downside is wasted engineering time, not production incident. Three risks are worth tracking:
6.0.2 of this package documents Swoole v6.0.2). A mismatched pair means the IDE suggests methods that don't exist at runtime, or hides ones that do — precisely the class of bug that costs an afternoon in a debugger and, worse, erodes trust in tooling. Mitigation is procedural, not technical: pin the helper to the extension's version line and bump both together.swoole.use_shortname divergence. The stubs advertise short aliases such as Co\Channel, but those only exist when swoole.use_shortname is On, and that directive can only be set in php.ini, never at runtime. Code that autocompletes cleanly locally can therefore fail in a container whose php.ini differs. This is the most likely source of real friction and the one to test explicitly in a dev container.swoole) that will not be done consistently without documentation. Related: the stubs must not be added to PHPStan/Psalm scanFiles paths, or static analysis will see duplicate class definitions.Key questions before adoption:
php --ri swoole succeed in our dev environment, and what version does it report? (This single check is the gate.)swoole.use_shortname in dev containers, and does our codebase use Co\ shortnames or fully qualified Swoole\ names?Stack fit: binary and easy to screen. Add the package only to applications whose runtime is Swoole-backed. For a Laravel + Octane-on-Swoole service, this is a clear yes. For a standard FPM service in the same monorepo, adding it centrally is harmless but noise — scope it per-application rather than to a shared root, so the dependency graph stays honest. Note the package is not Laravel-aware and needs no Laravel integration; it is a pure editor aid.
Migration path: additive, reversible, one commit. composer require --dev swoole/ide-helper:~X.Y.Z, matching the extension line reported by php --ri swoole. There is no migration in the conventional sense — nothing to backfill, no runtime surface to cut over, no data or config touched. Rollback is composer remove --dev swoole/ide-helper plus re-enabling PhpStorm's bundled stubs, which makes this a genuinely low-consequence decision. Do not commit the stubs, do not require them from composer.json autoload, and do not include them anywhere.
Compatibility: versioned lockstep, otherwise unconstrained. The package has essentially no PHP-version or framework constraints of its own; the only compatibility contract that matters is stub-version-to-extension-version. Verify that the chosen release exists on Packagist for the extension line in use — older lines such as 4.8.x and 5.x are published alongside 6.x, so long-lived services on 5.1 are covered. The @dev branch exists for unreleased stubs but should not be used in a team setting; unstable stubs are a self-inflicted drift risk.
Sequencing:
swoole stubs; confirm Intelephense indexes vendor/ for VS Code users.Co\ alias in a dev container with the production php.ini.Maintenance: trivial, but not zero — the chore is version coupling. No runtime upgrade surface, no CVE exposure of consequence (no executable code), no config drift. The recurring cost is one line in a runbook: when Swoole is upgraded, the helper is upgraded in the same change. Skip it and you get silent staleness rather than an error, which is why it must be an explicit checklist item rather than an assumption. Upstream cadence is healthy — releases track Swoole point releases closely, and the package is published by the Swoole organization itself, so abandonment risk is low and, critically, the fallback is benign: PhpStorm's bundled stubs still work, just less completely.
Support: no first-line burden, small second-line burden. No production support implications whatsoever. The realistic support tickets are "my autocomplete is wrong" and "PhpStorm says multiple definitions exist," both resolved by a documented FAQ. Assign ownership to the platform/developer-experience owner rather than an application team, since the fix is environmental.
Scaling: value scales with headcount, cost does not. The package costs nothing at runtime and nothing in infrastructure terms — it never reaches production containers. Its benefit compounds with team size and onboarding rate: every new engineer writing Swoole code hits the "undefined class" wall on day one without it. The offsetting factor is per-workstation setup, which scales linearly and is the main argument for documenting it in the onboarding guide rather than handling it ad hoc.
Failure modes, ranked:
php.ini — code compiles in the editor, fails at runtime in a way that looks like a Swoole bug rather than a config bug.--dev, and harmless if it did leak since nothing autoloads; not worth mitigations beyond standard --no-dev discipline.Ramp-up: roughly 15 minutes per engineer, once. Composer install, one IDE settings toggle for PhpStorm users, done. Budget half a day total for the rollout including documentation, plus a short note in the onboarding checklist. The only genuine prerequisite is the Swoole-presence check — get that answer first, because on a non-Swoole stack the entire assessment collapses to "do not adopt."
How can I help you explore Laravel packages today?