wyrihaximus/list-classes-in-directory
A small utility that scans a directory and returns the fully qualified class names found inside it. Handy for auto-discovery, registering implementations, building class maps, or wiring up plugin-style architectures without manually maintaining lists.
app/Modules and it works" developer experience. That's a DX/marketing feature for platform or SDK teams, and it materially affects onboarding time for internal or third-party integrators.make: style generators, scaffolding wizards, documentation/schema generation, and CI guardrails ("every class implementing PaymentGateway must be registered") — all things that reduce support burden rather than ship user-facing value.discover conventions or explicit config, and use this only for dev-time/tooling paths.Consider it when:
RecursiveDirectoryIterator + token parsing.Look elsewhere or build in-house when:
olvlvl/composer-attribute-collector targets that problem directly.composer/class-map-generator (the PHPStan/Composer workhorse) has far more usage and handles PSR-4/classmap/exclusion edge cases better; symfony/finder plus a tokenizer is the DIY path.Adoption checklist: pin the version, wrap it behind your own ClassDiscovery interface so swapping to composer/class-map-generator is a one-file change, benchmark scan time against your largest module directory, and add a test that fails if discovery silently returns zero classes.
To executives (one paragraph): We're evaluating a small, MIT-licensed PHP utility that lets the application find classes in a directory automatically. It's the enabler for two things teams keep asking for: a plugin/module system where new functionality is added by dropping in code rather than editing a central registry, and developer tooling that cuts boilerplate for scaffolding and CI checks. Cost is effectively zero — no infrastructure, no licensing, roughly a day of integration — and the risk is contained because we'll wrap it behind our own interface so it can be replaced in an hour. It is not a strategic bet; it's a cheap unblocker for DX and platform extensibility work, and I'd recommend a time-boxed spike rather than a roadmap commitment.
To engineering (summary): wyrihaximus/list-classes-in-directory returns fully qualified class names from directories and files, which is the piece we'd otherwise write ourselves for command/subscriber auto-registration and for codegen tooling. It's actively-ish maintained (release mid-2024) but small: ~24 stars, no dependents, single maintainer — so treat it as a convenience, not a foundation. Requirements before merge: (1) consume it only at boot or in CLI/CI contexts, never in the request path; (2) cache or manifest the results where scans would repeat; (3) put it behind an internal ClassDiscovery contract so we can move to composer/class-map-generator if edge cases bite; (4) add a test asserting non-empty discovery so a silent autoload/PSR-4 regression fails loudly. If the spike shows we need attribute collection or configurable runtime discovery, we escalate to a proper design rather than extending this dependency.
How can I help you explore Laravel packages today?