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

Finder Laravel Package

symfony/finder

Symfony Finder provides a fluent API to locate files and directories. Filter by name, path, size, dates, contents, and more; traverse recursively and iterate results easily—ideal for CLI tools, installers, and build scripts.

View on GitHub
Deep Wiki
Context7

Finds files and directories via an intuitive fluent interface

Frequently asked questions about Finder
How do I integrate Symfony Finder into a Laravel Artisan command?
Register the Finder service in your command’s constructor via Laravel’s container (e.g., `Finder::create()->in($this->storagePath)`). For cleaner usage, wrap it in a facade or service provider. Example: `Finder::create()->files()->name('*.jpg')->sortByDate()` in your command’s handle method.
Does Symfony Finder support Laravel’s filesystem (S3, FTP) out of the box?
No, Finder is filesystem-only. For cloud storage, use adapters like `league/flysystem` to bridge Finder with S3/FTP. Example: `Finder::create()->in($adapter->getAdapter()->getPathPrefix())` after mounting the adapter.
Can I use Symfony Finder in Laravel background jobs (Queues) for processing large files?
Yes, pass Finder iterators to jobs for lazy-loaded processing. Example: `OptimizeImagesJob::dispatch($finder->files()->name('*.png'))`. This avoids memory spikes by processing files one-by-one. For >100K files, combine with Laravel Queues + `symfony/process` for parallelism.
What’s the best way to wrap Symfony Finder in a Laravel facade for consistency?
Create a facade (e.g., `File`) with a service provider. In the provider, bind `Finder::create()` to a singleton. Example: `Facade::register('File', function() { return Finder::create(); })`. Then use `File::in('path')->files()`—mirroring Laravel’s `Storage` facade style.
How does Symfony Finder handle performance for large directories (e.g., 1M+ files)?
Finder uses lazy loading via iterators, so memory usage scales linearly. For 1M+ files, test with `->count()` first to avoid loading all results. For parallel processing, split results into chunks and dispatch Laravel jobs. Benchmark against `glob()` or `SplFileInfo` for your specific use case.
What Laravel versions and PHP requirements does Symfony Finder support?
Finder works with Laravel 8+ (PHP 8.0+) and Laravel 7 (PHP 7.4+ with Symfony 5.x). Use `^6.4` for PHP 7.4 or `^8.0` for PHP 8.0+ in `composer.json`. Check Symfony’s [Upgrading Guide](https://symfony.com/doc/current/setup/upgrade.html) for breaking changes between versions.
Are there alternatives to Symfony Finder for Laravel with built-in cloud storage?
Yes, consider `spatie/laravel-medialibrary` (for media) or `league/flysystem` wrappers (e.g., `spatie/flysystem-dropbox`). These integrate directly with Laravel’s Storage API and support S3/FTP. Finder is lighter but filesystem-only—choose based on your storage needs.
How do I test Symfony Finder in Laravel for cross-platform paths (Windows/Linux/macOS)?
Use Laravel’s `Storage` facade to mock paths in tests (e.g., `Storage::fake('local')`). Test edge cases like symlinks with `Finder::create()->ignoreDotFiles()->followLinks()`. Run CI tests on GitHub Actions with matrix builds for Linux/Windows/macOS to catch path inconsistencies.
Can I use Symfony Finder to replace Laravel’s `glob()` or `DirectoryIterator` in existing code?
Absolutely. Replace `glob('*.php')` with `Finder::create()->files()->name('*.php')`. For `DirectoryIterator`, use `Finder::create()->in($path)->files()`—it’s more fluent and supports additional filters (e.g., `->size('<1MB')`). Start with small replacements and refactor incrementally.
What’s the maintenance status of Symfony Finder, and how often does it break Laravel apps?
Finder is actively maintained by Symfony with minimal breaking changes. The risk is low for Laravel apps using `^8.0` or `^7.4` in `composer.json`. Monitor Symfony’s [deprecations](https://symfony.com/doc/current/setup/upgrade.html) and Laravel’s [release notes](https://blog.laravel.com/) for compatibility. No major issues reported in Laravel integrations.
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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony