alexkomaralex/file-search-bundle
Illuminate\Filesystem) and Flysystem integrations may require custom adapters.mbstring) may need review.vendor/bin) or a micro-service approach mitigates this.spatie/fork).spatie/laravel-searchable (for database-backed search).barryvdh/laravel-ide-helper (for code-specific searches).Symfony\Component\Finder wrapper in Laravel.Laravel Compatibility:
Finder adapter) via Flysystem or Laravel’s Storage facade.// FileSearchServiceProvider.php
public function register() {
$this->app->singleton('file-search', function ($app) {
return new AlexkomaralexFileSearchBundle\SearchCommand(
new SymfonyFinderAdapter($app['filesystem'])
);
});
}
/vendor/bin/fsearch) and call it via Laravel’s Process facade.Illuminate\Filesystem and Artisan commands (high effort, but future-proof).Dependency Isolation:
replace or a separate vendor directory to avoid conflicts with Laravel’s Symfony components.composer.json snippet:
"extra": {
"laravel": {
"dont-discover": ["Alexkomaralex\\FileSearchBundle\\*"]
}
}
LaravelFinderAdapter) that translates Symfony’s Finder to Laravel’s Filesystem.// app/Console/Commands/SearchFiles.php
class SearchFiles extends Command {
protected $signature = 'search:files {query} {--path=}';
public function handle() {
$results = app('file-search')->search($this->argument('query'), $this->option('path'));
$this->output->table(['Path'], $results);
}
}
Illuminate\Cache) for frequent queries.Symfony\Component\DependencyInjection → Use Laravel’s Container or Binding.Symfony\Component\Console → Replace with Laravel’s Artisan (similar API).Symfony\Component\Finder\Finder with Laravel’s Illuminate\Filesystem\Filesystem or Flysystem.class LaravelFinderAdapter {
public function __construct(private Filesystem $filesystem) {}
public function find(string $path, string $query): array {
return array_filter($this->filesystem->allFiles($path), function ($file) use ($query) {
return str_contains(file_get_contents($file), $query);
});
}
}
| Step | Task | Dependencies | Owner |
|---|---|---|---|
| 1 | Validate bundle in Symfony 2.5 | None | Dev |
| 2 | Create Laravel service provider | Symfony bundle | TPM/Dev |
| 3 | Build LaravelFinderAdapter |
Laravel Filesystem | Dev |
| 4 | Integrate with Artisan | Service provider | Dev |
| 5 | Add caching layer | Laravel Cache | Dev |
| 6 | Performance test (10K+ files) | Queue workers | QA |
| 7 | Document CLI usage | Artisan command | TPM |
composer.json.debug:search Artisan command to log adapter interactions.php artisan search:files "query").n files. Mitigate with:
files table with content_hash column).spatie/fork to split scans across processes.fopen()./var/www/{a-z}) and query in parallel.| Scenario | Impact | Mitigation |
|---|---|---|
| Disk I/O saturation | Slow searches, timeouts | Add rate limiting; use SSD storage. |
| Permission denied | Partial scans | Run CLI as www-data or use sudo in Docker. |
| Memory exhaustion | Crashes | Increase memory_limit; stream file content. |
| Query syntax errors | CLI failures | Validate input (e.g., reject regex without delimiters). |
| Dependency conflicts | Laravel app breaks | Use composer install --no-dev in isolation. |
How can I help you explore Laravel packages today?