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
Laravel Ide Helper

Laravel Ide Helper Laravel Package

barryvdh/laravel-ide-helper

Generates accurate PHPDoc helper files for Laravel to improve IDE autocompletion and type hints. Create _ide_helper.php for facades, add or export model PHPDocs, fluent methods, factory builders, and PhpStorm container metadata—kept in sync with your project.

View on GitHub
Deep Wiki
Context7

IDE Helper for Laravel

Frequently asked questions about Laravel Ide Helper
How do I install barryvdh/laravel-ide-helper for Laravel 10+?
Run `composer require --dev barryvdh/laravel-ide-helper` to install the package. Ensure you’re using the 3.x branch, which supports Laravel 10 and later. No additional Laravel configuration is required.
Will this work with VS Code instead of PhpStorm?
While primarily optimized for PhpStorm, it works with VS Code via plugins like Intelephense. For VS Code, generate the helper files with `php artisan ide-helper:generate` and ensure your IDE is configured to recognize the `_ide_helper.php` file.
Can I generate PHPDocs for models without writing directly to the model files?
Yes, use the `--nowrite` flag with `php artisan ide-helper:models` to generate a standalone `_ide_helper_models.php` file instead of modifying your model files directly. This avoids merge conflicts in version control.
How do I handle custom Eloquent relationships (e.g., polymorphic or custom packages)?
Extend the package by defining custom relationship types in the `additional_relation_types` config array or implement `ModelHookInterface` for complex logic. Test thoroughly, as unsupported relationships may not generate correct PHPDocs.
Is there a way to automate PHPDoc generation in CI/CD pipelines?
Yes, add `post-update-cmd` to your `composer.json` to run `php artisan ide-helper:generate` after dependencies are installed. For model PHPDocs, use SQLite in-memory mode (`-M`) or mock database connections to avoid dependency issues.
What Laravel versions does barryvdh/laravel-ide-helper support?
The 3.x branch supports Laravel 10+. For older versions (Laravel 5.5–9.x), use the 2.x branch. Always pin the package version in `composer.json` to avoid compatibility issues during Laravel upgrades.
How do I reset or regenerate PHPDocs for existing models?
Use `php artisan ide-helper:models -RW` to reset and rewrite PHPDocs directly to model files. Backup your models first, as this overwrites existing PHPDocs. For safer regeneration, use `--nowrite` and manually merge changes.
Does this package support fluent method autocompletion in migrations?
Yes, enable fluent method support by setting `include_fluent` to `true` in the config. Run `php artisan ide-helper:generate` to include fluent method PHPDocs in `_ide_helper.php`, improving autocompletion for query builder methods in migrations.
What are the performance implications for large Laravel projects?
Generation time scales with the number of models and facades. Exclude ignored models via `--ignore` to speed up generation. For very large projects, monitor generation time and consider running it in a separate CI job or during off-peak hours.
Are there alternatives to barryvdh/laravel-ide-helper for IDE autocompletion?
Alternatives include `nWidart/laravel-models-generator` (for model stubs) or IDE-specific plugins like Intelephense for VS Code. However, `barryvdh/laravel-ide-helper` is the most comprehensive for Laravel’s facades, fluent methods, and Eloquent, with deep integration into Laravel’s architecture.
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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony