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

Class Explorer Laravel Package

thecodingmachine/class-explorer

A PHP utility that discovers classes in your codebase by interface, parent class, attribute, or namespace. Built on Roave BetterReflection, it lets you explore implementations without loading them, making it handy for building registries, plugin systems, and convention-based discovery.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. The package appears to be a class-discovery/classmap utility for Laravel/PHP applications. The new getClassMap method—returning classes and their associated files—fits naturally alongside Composer’s autoloader and Laravel’s own discovery mechanisms (event discovery, command discovery, policy discovery). For modular monoliths, package-based plugins, attribute-driven registration, or custom route/event scanning, a first-class classmap API reduces ad-hoc glob()/ReflectionClass code. It is complementary rather than competitive with Laravel’s container; the main architectural question is whether it becomes a second source of truth for class location alongside Composer.

Integration feasibility. Integration looks low-friction: Composer installation, no apparent service-provider requirement implied by the notes, and a single new public method with an intuitive return shape (class => file). The cache-key bugfix implies the package already has a caching layer, so consumers inherit performance benefits but also cache lifecycle responsibilities. Feasibility is high for teams already doing filesystem-based class discovery; lower for teams that rely exclusively on Composer’s optimized classmap.

Technical risk. The primary risk is cache correctness. The bugfix confirms that the cache key previously failed to account for the recursive parameter, meaning two calls with different recursion settings could collide. That is now fixed, but existing cached entries created under v1.0.x may remain keyed under the old scheme and could produce stale or incorrect results after upgrade. A cache clear/namespace change should be part of the rollout. Secondary risks: classmap scanning cost on large repositories, stale maps after file moves/renames in long-running processes, and behavior differences around symlinks, excluded directories, and non-PSR-4 files. The getClassMap method is additive and appears non-breaking, but the return contract, ordering guarantees, and handling of duplicate/conditional classes are undocumented in the notes.

Key questions.

  • What cache store and key format does the package use, and are keys versioned to avoid cross-version collisions?
  • Does getClassMap honor Composer’s autoload rules/exclusions, or does it perform an independent filesystem scan?
  • What is the default for the recursive parameter, and did the cache-key fix change any observable behavior?
  • Is the returned map deterministic (sorted, deduplicated), and how are classes in the same file or multiple files per class handled?
  • What are the PHP/Laravel version constraints for v1.1.0, and is there a upgrade guide beyond the changelog?
  • What is the performance profile on a large app/ and vendor/ tree, and is cache warming supported?

Integration Approach

Stack fit. Suitable for standard Laravel applications and PHP packages running Composer autoloading. Best fit is Laravel 8+ on PHP 8.x, though the actual constraints should be verified in composer.json. It fits cleanly into service providers, console commands, and build/deploy scripts where a class-to-file map is needed. It is less compelling where Composer’s --optimize-autoloader classmap already satisfies the use case.

Migration path. From v1.0.x, the release is additive (getClassMap) plus a bugfix, so no code changes are expected for existing consumers. The cache-key change means old cache entries may be orphaned rather than automatically invalidated; recommend clearing the application/package cache during upgrade. If the package uses Laravel’s cache, php artisan cache:clear plus a deploy-time cache warm should suffice; if it uses its own store, follow the package’s documented purge mechanism.

Compatibility. Verify PHP and Laravel constraints before upgrading, and confirm the cache driver in use (file, Redis, array) behaves consistently. Test in CI with the same cache driver as production, since the bugfix is cache-related. Watch for interactions with opcache and long-running workers (Octane/queue workers), where a stale in-process classmap may persist until restart.

Sequencing.

  1. Upgrade in a feature branch and run the existing test suite.
  2. Clear all caches, then exercise getClassMap with both recursive values to confirm distinct, correct results.
  3. Validate the map against Composer’s autoload_classmap.php for a representative module.
  4. Add cache clearing/warming to the deployment pipeline before rolling to staging.
  5. Roll to production with a worker restart (Queue/Octane) and monitor discovery-related failures.
  6. Document the new method for internal consumers and deprecate any bespoke scanning utilities it replaces.

Operational Impact

Maintenance. Low ongoing maintenance: the package has a narrow surface area and the v1.1.0 changelog shows active maintenance and responsiveness to issues (#9–#11). The main maintenance duty is keeping the cache lifecycle aligned with deployments and being aware of upstream releases that touch caching or discovery semantics.

Support. Support depends on the package maintainer and community; the bugfix references suggest issue-tracker activity. Internally, teams should own the integration points—cache clearing, deploy hooks, and any code that depends on the classmap shape—rather than assuming upstream will catch environment-specific issues.

Scaling. Classmap generation cost scales with the number of files scanned, so caching is essential. On large monorepos, warm the cache during deploy rather than on first request to avoid latency spikes. Memory footprint of a large class => file array should be measured; if the map is only needed for build-time tooling, generate it in CI and avoid holding it in long-lived workers.

Failure modes.

  • Stale cache after class renames/moves, especially in long-running processes.
  • Cache-key collisions if multiple package versions or recursion settings coexist during a rolling deploy.
  • Empty or partial maps from incorrect paths, permissions, or excluded directories.
  • Symlink and non-PSR-4 edge cases producing missing or duplicate entries.
  • Performance degradation if caching is disabled or cold on every request.
  • Silent behavior differences between recursive true/false if callers assumed the pre-fix cached result.

Ramp-up. Low for Laravel developers: getClassMap is self-describing and the integration is a Composer dependency plus a cache-clear step. Teams should budget a short spike to confirm return-shape expectations, cache behavior, and performance on their largest module before broad adoption.

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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource