Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Ide Helper Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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.

Implementation Patterns

  • IDE-only stub usage: The package contains only .php stub files—no runtime code. Keep it in require-dev to prevent bloating production builds.
  • Version alignment: Always match 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 development: When building servers with Swoole\Server, IDE hints improve callback signatures (e.g., on('request', fn($request, $response) => {...})) and reduce typos in enum options like SWOOLE_PROCESS.
  • Annotation reuse: Copy return types from stubs into your own PHPDoc (e.g., @return Swoole\Server\Port|false) for better static analysis with Psalm/PHPStan.

Gotchas and Tips

  • 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.
  • Stubs ≠ runtime behavior: Stub signatures assume default config (e.g., swoole.enable_coroutine=On). Runtime coroutines may behave differently under preemptive scheduling—always test edge cases in dev env.
  • IDE indexing pitfalls: In PHPStorm, ensure vendor/swoole/ide-helper/ isn’t in Excluded Paths; in VS Code, verify Intelephense indexes vendor/ (set "intelephense.environment.includePaths" if needed).
  • Avoid @dev in prod: Using swoole/ide-helper:@dev introduces breaking changes without warning. Pin to stable releases matching your Swoole version for reliability.
  • Zero runtime footprint—but watch disk: The package adds ~2MB of stubs. Commit only if your repo is Swoole-specific (e.g., hyperf microservices), otherwise keep it require-dev and .gitignore the vendor dir.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport