Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Ranger Laravel Package

laravel/ranger

Ranger is a Laravel introspection library that walks your codebase and collects routes, models, enums, broadcast events, environment variables, and Inertia components. Register callbacks that fire as each item is discovered and receive a detailed DTO. Currently in beta.

View on GitHub
Deep Wiki
Context7

Laravel Ranger is a powerful introspection library for Laravel applications. It walks your codebase and collects detailed information about your application's components, firing registered callbacks as each item is discovered with a typed DTO you can inspect or act on.

  • Discovers routes, models, enums, broadcast events, environment variables, and Inertia.js components
  • Register per-item callbacks (onRoute, onModel) or collection callbacks (onRoutes, onModels)
  • Each callback receives a detailed Data Transport Object with rich accessors
  • A single $ranger->walk() call triggers all discovery and callbacks
Frequently asked questions about Ranger
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.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
vento/laravel-airbrake
wfeller/laravel-batch
maco-studios/mage-os-installer
busarm/armie
siberfx/laravel-logger
kfteam1991/dcat-admin
dashed/dashed-laposta
dashed/dashed-ecommerce-montaportal
dashed/dashed-ecommerce-etsy
neohq/string-blade-compiler
log1x/acf-composer
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager