- What is Laravel Ranger used for?
- Laravel Ranger is a callback-driven introspection library for Laravel applications. It walks your codebase and collects typed DTOs for routes, models, enums, broadcast events, environment variables, and Inertia components. You register onRoute, onModel, onEnum, onBroadcastEvent, or onInertiaComponent callbacks, call walk(), and send the results to any sink such as JSON, Markdown, OpenAPI, or TypeScript types. It is dev and CI tooling, not a runtime request-path package.
- How do I install Laravel Ranger in a Laravel app?
- Install it with Composer as a development dependency, for example composer require --dev laravel/ranger, and run it from an Artisan command or CI job. Because it introspects a bootstrapped Laravel application, it belongs in require-dev rather than production dependencies. Pin an exact version such as 0.2.5 while the package is pre-1.0.
- Which Laravel and PHP versions does Laravel Ranger support?
- The evaluated stack fit is Laravel 11 through 13 on PHP 8.2 or newer. Laravel 13 support landed in Ranger 0.1.9, and the package is at 0.2.5 in this assessment. Always check the package constraints and changelog before upgrading, because the beta API can change.
- Is Laravel Ranger stable enough for production?
- No, treat it as beta tooling and keep it out of production runtime paths. The README warns the API will likely change before v1.0.0, and breaking renames have already occurred, such as ClassResult to ClassLikeResult in 0.2.5. Pin the exact version and isolate DTO consumption behind an adapter so upgrades are deliberate.
- How does Laravel Ranger collect routes and models?
- You resolve the Ranger service, register callbacks such as onRoute and onModel, and call walk(). Ranger discovers each component and passes a typed DTO to your callback, and collection-level callbacks like onRoutes and onModels fire after discovery completes. Your code decides what to do with the DTOs, for example write JSON artifacts or documentation.
- Does Laravel Ranger read .env values or only variable names?
- Ranger includes an environment variable collector that reads .env, so you must verify whether your version emits values or only keys before publishing artifacts. The assessment flags secret exposure as a material risk for CI logs and wikis. Redaction availability is not established in the provided context, so test and filter output before sharing it.
- Can Laravel Ranger generate OpenAPI or TypeScript definitions?
- Ranger itself produces DTOs and fires callbacks; it does not impose a rendering format. You route route DTOs to an OpenAPI generator, model and enum DTOs to a data catalog or shared constant docs, and Inertia component DTOs to TypeScript prop types. That callback-to-sink design is what makes it useful for engineering inventory.
- Why is Laravel Ranger missing some routes, models, or events?
- Ranger introspects a running Laravel app, so anything registered dynamically or conditionally may be missed, including tenancy, feature-flagged route files, and package providers. Silent under-collection is more dangerous than a crash because generated docs can look authoritative while being incomplete. Validate output against php artisan route:list and a sample of models before replacing hand-maintained docs.
- Does Laravel Ranger require a database connection to inspect models?
- Ranger bootstraps a real Laravel application and depends on the Surveyor static analyzer, so it is not a pure source-file scanner. The provided assessment explicitly asks whether model attribute typing needs a live database connection and migrations or derives from casts and source analysis. Confirm that behavior in your environment before relying on model metadata in CI.
- How should I run Laravel Ranger safely in CI?
- Pin laravel/ranger to an exact version, wrap it in one IntrospectionService adapter, and run it from an Artisan command in a dev or CI context. Check output determinism and stable ordering so CI diffs are meaningful, and verify boot-time side effects such as provider boot and observers. Filter or redact environment data, and compare generated results with route:list before publishing.