swoole/ide-helper
IDE stub files for the Swoole PHP extension, providing accurate autocompletion and type hints in supported IDEs. Install via Composer (prod or dev) or track master for latest stubs. Includes notes on key Swoole php.ini directives and short names.
Install the package as a dev dependency to get Swoole extension autocompletion in your IDE:
composer require --dev swoole/ide-helper:~6.0.0
Ensure your Swoole extension version matches the stubs (e.g., swoole_version() returns 6.0.2). Once installed, start typing Swoole classes like Swoole\Coroutine::sleep() or new Swoole\Http\Server(...)—your IDE (PHPStorm, VS Code + Intelephense) will auto-populate parameter names, types, and return values. No runtime configuration needed.
.php stub files—no runtime code. Keep it in require-dev to prevent bloating production builds.swoole/ide-helper version to your Swoole extension (check php -m | grep swoole). Mismatched versions cause misleading signatures (e.g., missing 6.x methods in 5.x stubs).Swoole\Server, IDE hints improve callback signatures (e.g., on('request', fn($request, $response) => {...})) and reduce typos in enum options like SWOOLE_PROCESS.@return Swoole\Server\Port|false) for better static analysis with Psalm/PHPStan.use_shortname conflict: If swoole.use_shortname=Off in php.ini, your IDE will still show aliases like Co::sleep() (from stubs), but runtime will fail. Either enable shortnames or disable stub shortname entries via IDE settings or phpcs rules.swoole.enable_coroutine=On). Runtime coroutines may behave differently under preemptive scheduling—always test edge cases in dev env.vendor/swoole/ide-helper/ isn’t in Excluded Paths; in VS Code, verify Intelephense indexes vendor/ (set "intelephense.environment.includePaths" if needed).@dev in prod: Using swoole/ide-helper:@dev introduces breaking changes without warning. Pin to stable releases matching your Swoole version for reliability.hyperf microservices), otherwise keep it require-dev and .gitignore the vendor dir.How can I help you explore Laravel packages today?