- What Laravel versions does Surveyor support?
- Surveyor is designed for modern Laravel applications (likely 9.x+ based on Laravel’s ecosystem). Check the [GitHub repo](https://github.com/laravel/surveyor) for the exact version requirements, as the README may specify compatibility with specific Laravel releases. Always test in a staging environment before production use.
- Can Surveyor analyze non-Laravel PHP projects?
- No, Surveyor is Laravel-specific and relies on Laravel’s Service Container, Facades, and Eloquent models. Non-Laravel projects would require significant customization, such as mocking Laravel bindings or rewriting parts of the analysis logic. For generic PHP analysis, consider PHPStan or Psalm instead.
- How do I cache Surveyor’s analysis results to improve performance?
- Enable caching by setting the `SURVEYOR_CACHE_ENABLED=true` environment variable. Surveyor uses file modification tracking for cache invalidation, but for distributed environments (e.g., CI/CD or serverless), consider storing cache in Redis or another shared storage. Cache may not be 100% reliable for dynamic codebases.
- Will Surveyor break my CI/CD pipeline if it fails?
- Surveyor is not designed to block builds by default, but you can integrate it into CI/CD as a pre-commit hook or nightly job. If analysis fails (e.g., due to DB connection issues or memory limits), handle failures gracefully with fallback mechanisms, like skipping analysis or logging warnings instead of failing the pipeline.
- How accurate is Surveyor’s model analysis (e.g., Eloquent relationships)?
- Surveyor inspects models by briefly connecting to the database, which can miss runtime behaviors like dynamic relationships or polymorphic associations. For critical paths, manually verify Surveyor’s output against your database schema or use it as a starting point for further validation tools like Laravel Ranger.
- Can Surveyor generate OpenAPI/Swagger specs from Laravel controllers?
- Yes, Surveyor extracts structured metadata (e.g., route parameters, return types, request validation) that can be used to generate OpenAPI specs. Pair it with tools like `darkaonline/l5-swagger` or custom scripts to transform Surveyor’s DTOs into OpenAPI format. The beta API may require adjustments to the output structure.
- What are the memory requirements for large Laravel applications?
- Surveyor can be memory-intensive for large codebases (e.g., 10,000+ files). Start with a pilot analysis of a single module to test performance. Monitor memory usage in your environment and consider running Surveyor in a container with increased memory limits or splitting analysis into smaller batches.
- How do I handle Surveyor’s beta API changes in production?
- Since Surveyor is pre-v1.0, expect breaking changes. Monitor the [changelog](https://github.com/laravel/surveyor/blob/main/CHANGELOG.md) and test updates in a staging environment. For critical workflows, implement version checks or feature flags to isolate Surveyor-dependent logic until stability improves.
- Does Surveyor support analyzing Inertia.js or Livewire components?
- Surveyor can analyze Inertia.js props and Livewire components if they are defined in PHP classes (e.g., `public $prop` in Livewire or type-hinted Inertia page classes). However, dynamic props or JavaScript-side logic won’t be captured. For full coverage, combine Surveyor with frontend tooling like TypeScript.
- Are there alternatives to Surveyor for Laravel static analysis?
- For generic PHP analysis, use PHPStan or Psalm. For Laravel-specific needs, Surveyor fills gaps like Facade resolution, Eloquent model inspection, and Inertia props. Laravel IDE Helper improves IDE autocompletion but lacks Surveyor’s structured metadata output. For runtime validation, consider Pest or custom tests alongside Surveyor.