You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This package makes use of [Laravels package auto-discovery mechanism](https://medium.com/@taylorotwell/package-auto-discovery-in-laravel-5-5-ea9e3ab20518), which means if you don't install dev dependencies in production, it also won't be loaded.
41
-
42
-
If for some reason you want manually control this:
43
-
- add the package to the `extra.laravel.dont-discover` key in `composer.json`, e.g.
44
-
```json
45
-
"extra": {
46
-
"laravel": {
47
-
"dont-discover": [
48
-
"barryvdh/laravel-ide-helper"
49
-
]
50
-
}
51
-
}
52
-
```
53
-
- Add the following class to the `providers` array in `config/app.php` (`bootstrap/providers.php` for Laravel 11+):
If you want to manually load it only in non-production environments, instead you can add this to your `AppServiceProvider` with the `register()` method:
> Note: Avoid caching the configuration in your development environment, it may cause issues after installing this package; respectively clear the cache beforehand via `php artisan cache:clear` if you encounter problems when running the commands
69
36
70
37
## Usage
71
38
39
+
### TL;DR
40
+
41
+
Run this to generate autocompletion for Facades. This creates _ide_helper.php
42
+
43
+
```
44
+
php artisan ide-helper:generate
45
+
```
46
+
47
+
Run this to add phpdocs for your models. Add -RW to Reset existing phpdocs and Write to the models directly.
48
+
```
49
+
php artisan ide-helper:models -RW
50
+
```
51
+
52
+
If you don't want the full _ide_helper.php file, you can run add `--write-eloquent-helper` to the model command to generate small version, which is required for the `@mixin \Eloquent` to be able to add the QueryBuilder methods.
53
+
54
+
If you don't want to add all the phpdocs to your Models directly, you can use `--nowrite` to create a seperate file. The `--write-mixin` option can be used to only add a `@mixin` to your models, but add the generated phpdocs in a seperate file. This avoids having the results marked as duplicate.
55
+
56
+
72
57
_Check out [this Laracasts video](https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/15) for a quick introduction/explanation!_
73
58
74
59
-`php artisan ide-helper:generate` - [PHPDoc generation for Laravel Facades ](#automatic-phpdoc-generation-for-laravel-facades)
@@ -86,8 +71,6 @@ You can now re-generate the docs yourself (for future updates)
86
71
php artisan ide-helper:generate
87
72
```
88
73
89
-
> Note: `bootstrap/compiled.php` has to be cleared first, so run `php artisan clear-compiled` before generating.
90
-
91
74
This will generate the file `_ide_helper.php` which is expected to be additionally parsed by your IDE for autocomplete. You can use the config `filename` to change its name.
92
75
93
76
You can configure your `composer.json` to do this each time you update your dependencies:
@@ -149,6 +132,8 @@ The class name will be different from the model, avoiding the IDE duplicate anno
149
132
150
133
> Please make sure to back up your models, before writing the info.
151
134
135
+
> You need the _ide_helper.php file to add the QueryBuilder methods. You can add --write-eloquent-helper/-E to generate a minimal version. If this file does not exist, you will be prompted for it.
136
+
152
137
Writing to the models should keep the existing comments and only append new properties/methods. It will not update changed properties/methods.
153
138
154
139
With the `--reset (-R)` option, the whole existing PHPDoc is replaced, including any comments that have been made.
0 commit comments