Weave Code
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 Finder Laravel Package

danog/class-finder

Fast PHP class discovery utility. Scan directories/files and find classes, interfaces, and traits without manually maintaining lists. Useful for autoload-based plugins, reflection tooling, and package indexing, with a simple API and minimal setup.

View on GitHub
Deep Wiki
Context7

Missing composer.json

Example PHP:

<?php

require_once __DIR__ . '/../vendor/autoload.php';

use danog\ClassFinder\ClassFinder;

$classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar');

Results in this exception:

Could not locate composer.json. You can get around this by setting ClassFinder::$appRoot manually.

ClassFinder requires a composer.json to load autoloading settings. In this situation, ClassFinder wasn't able to find it when recursively searching for it. You will need to tell ClassFinder where the root of your application is - this is the directory that contains the composer.json configuration and where classes will be searched out of.

<?php

require_once __DIR__ . '/../vendor/autoload.php';

use danog\ClassFinder\ClassFinder;

ClassFinder::setAppRoot(realpath(__DIR__ . '../../app/')); // This is suggesting that the app root is really someone else.
$classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar');

This is an exotic situation and shouldn't apply to most projects.

If this information doesn't resolve the issue, please feel free to submit an issue.

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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4