laravel/surveyor
Laravel Surveyor is a mostly static analysis tool that parses PHP files to extract detailed metadata about classes, methods, properties, and return types, exposing it in a structured format other tools can consume. Currently in beta.
StringType, ArrayShapeType, UnionType, ClassType, etc.) plus validation-rule extraction makes this a credible substrate for generating TypeScript types, form schemas, or API client stubs from Laravel code. The "Ignore Markers" design — where the consumer ships its own attribute implementing Ignored, with when/unless conditions and comment tags for array keys — is a clear tell that the intended use case is codegen that must let application authors exclude things like secrets or internal-only fields.Adopt when:
SURVEYOR_CACHE_ENABLED, SURVEYOR_CACHE_DIR), which tracks file mtimes and cross-file dependencies (parent classes, traits) for invalidation.Look elsewhere when:
Reflection* API and composer autoload data cover a surprising amount at zero dependency cost.Markers::registerConditionResolver() before reading results, and until then every conditional marker hides — a sharp edge worth pricing in.To executives: This is a free, first-party Laravel package that reads our codebase and returns a structured description of it — classes, methods, types, validation rules, database-backed model attributes and relationships. It is the foundation layer for automating work we currently do by hand: generating frontend types, keeping API and data documentation accurate, scaffolding admin screens, and eventually assisting framework upgrades. Cost is a Composer dependency; the alternative is building and maintaining a PHP parser ourselves, which is a multi-engineer, multi-quarter effort with no product differentiation. The honest caveat: it is officially in Beta with a pre-1.0 API, near-zero public adoption, and known performance limits. We therefore propose a time-boxed, contained pilot behind our own abstraction layer, pinned to an exact version, with a go/no-go before we let any shipped feature depend on it. Downside is bounded to one engineer-quarter; upside is a reusable capability across several roadmap items.
To engineering: You get parsed class metadata, a full PHP type system, Eloquent model introspection (casts, relations, accessors), and a dependency-aware disk cache so repeat analysis is cheap. You do not get to skip the integration work: the API will change before 1.0.0, so wrap Analyzer and ClassLikeResult behind an internal interface and never let package types leak into domain code. Expect to need a database connection at analysis time and to profile memory on our largest app before committing. Ignore-marker semantics are subtle — conditions are resolved when a member is read, not when the file is analyzed, so cached analyses store the condition and not its answer; register a condition resolver early and test it. Pair with Laravel Ranger if we want ready-made DTOs instead of raw results. Plan a version-pin and a quarterly upgrade review, and contribute back on the performance work — the maintainers are explicitly soliciting it, which is the cheapest way to buy influence over a dependency we may come to rely on.
How can I help you explore Laravel packages today?