Starting from 4.1.1 version Laravel Idea allows to highly customize completions, view paths, and blade component sources by adding a special ide.json
file to the project. This can be super useful for Laravel package creators.
Example ide.json
:
{
"$schema": "http://laravel-ide.com/schema/laravel-ide-v1.json",
"completion": {
"route": [
{
"methods": ["routeForTenant"],
"functions": ["customRouteFunction"],
"parameters": [1]
},
{
"functions": ["anotherRoute"]
}
],
"routeAction": [
{
"methods": ["actionForTenant"],
"classes": ["Tenant"],
"parameters": [1]
}
],
"config": [
{
"functions": ["customConfig"],
"parameters": [1]
},
{
"functions": ["storageFunc"],
"parameters": [1],
"prefix": "filesystems.disks"
}
],
"translation": [
{
"functions": ["customTrans"],
"parameters": [1]
}
],
"view": [
{
"functions": ["customView"],
"parameters": [1]
}
]
},
"view": {
"paths": [
{
"path": "test/views",
"namespace": "test"
}
]
},
"blade": {
"components": {
"viewPaths": [
{
"path": "directory/with/blade/component/views",
"namespace": "namespace"
},
{
"path": "resources/views/components",
"namespace": "",
"prefix": "jet-",
"viewNamespace": "jetstream"
}
]
}
}
}
"$schema" value is not required, but it will add a full completion for all JSON keys.
These completions will be added:
View root with test
namespace and "test/views" path will appear in the completions. All paths are related to the ide.json
path, so test
folder should be in the same directory with ide.json
file.
All blade files in the directory/with/blade/component/views
folder will be used as blade components with namespace
: <x-namespace::foo>
Jetstream package converts all views from its resources/views/components
folder to blade components by changing jetstream
namespace to empty and adding jet-
prefix. Laravel Idea has support for Jetstream, but all this "support" can be implemented by this simple instruction in the ide.json
file.