Installation:
composer require --dev bnomei/scip-laravel
Ensure your project uses Laravel 11-13 and PHP 8.3+.
First Run: Execute the CLI command in your project root:
vendor/bin/scip-laravel generate
This generates index.scip in the project root, merging SCIP data from:
scip-php)Surveyor and Ranger).Where to Look First:
index.scip for generated data..scip-laravel.php (auto-generated in config/).scip-php, Surveyor, and Ranger are installed (they’re auto-included as dev deps).Use index.scip with tools like:
Route::, Model::).F12 (Go to Definition).Integrate into CI/CD:
Add to your composer.json scripts:
"scripts": {
"post-update-cmd": [
"@php vendor/bin/scip-laravel generate"
]
}
Run composer update to auto-generate index.scip.
Selective Indexing:
Exclude files/dirs via .scip-laravel.php:
return [
'exclude' => [
'storage/*',
'tests/*',
'vendor/*',
],
];
Custom Metadata:
Extend Laravel-specific data via Surveyor hooks (e.g., add custom route tags):
// In a ServiceProvider
Surveyor::extend(function ($surveyor) {
$surveyor->routeTags(['api' => 'routes/api.php']);
});
Ranger Integration:
Ensure laravel/ranger is installed (auto-included). It provides:
Route::get('/user', ...).SCIP-php Customization:
Override scip-php behavior via .scip.php (e.g., ignore abstract classes):
return [
'ignore' => [
'abstract',
'trait',
],
];
IDE Sync:
For VS Code/PHPStorm, add index.scip to your project’s .gitignore (it’s auto-generated) but keep it in version control for team consistency.
Performance:
index.scip may take minutes for monorepos. Run in CI during off-peak hours.--verbose flag:
vendor/bin/scip-laravel generate --verbose
Dependency Conflicts:
scip-php, Surveyor, and Ranger versions are compatible (check their respective composer.json).composer.json:
"require-dev": {
"bnomei/scip-laravel": "^1.0",
"laravel/surveyor": "^1.0",
"laravel/ranger": "^1.0"
}
IDE-Specific Issues:
index.scip to refresh the SCIP index.Settings > Plugins.Invalid Index:
Delete index.scip and regenerate. If issues persist, check:
storage/logs/laravel.log).scip-laravel logs (enable with --verbose).Missing Metadata:
Verify Ranger is collecting data (e.g., routes/models). Test with:
vendor/bin/ranger inventory
Custom SCIP Data:
Use Surveyor::extend() to inject custom metadata (e.g., API documentation):
Surveyor::extend(function ($surveyor) {
$surveyor->addMetadata('api:description', 'User API', 'routes/api.php');
});
Post-Processing:
Modify index.scip after generation (e.g., with jq):
jq '.nodes |= map(select(.kind == "namespace"))' index.scip > filtered.scip
CI-Cache:
Cache index.scip in CI to avoid regenerating on every run:
# GitHub Actions example
- name: Cache SCIP index
uses: actions/cache@v3
with:
path: index.scip
key: ${{ runner.os }}-scip-${{ hashFiles('**/composer.lock') }}
index.scip in your repo (even if auto-generated) to ensure all devs have consistent IDE features.--project-dir to generate indexes for sub-projects:
vendor/bin/scip-laravel generate --project-dir=packages/api
index.scip to a shared location for multi-repo projects:
ln -s ../project-a/index.scip ./index.scip
How can I help you explore Laravel packages today?