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
Ghost Hunter Bundle

Ghost Hunter Bundle Laravel Package

anja/ghost-hunter-bundle

View on GitHub
Deep Wiki
Context7

A quality assistant to hunt down unused files (templates & assets) in Symfony.

Frequently asked questions about Ghost Hunter Bundle
Can I use Ghost Hunter Bundle directly in a Laravel project without Symfony?
No, the bundle is Symfony-specific and requires significant adaptation for Laravel. You’d need to replace Twig parsing with Blade logic (e.g., using `blade-compiler` or regex) and map assets to Laravel’s `mix-manifest.json` or Vite outputs. A hybrid approach with custom wrappers is recommended.
How do I detect unused Blade templates in Laravel if this bundle doesn’t support it natively?
Traverse `resources/views` with `File::allFiles()`, parse `@extends`, `@include`, and `@component` directives to build a dependency graph, then cross-reference with route usage logs or Laravel’s `view` event listeners. Tools like `laravel-blade-compiler` can help analyze Blade syntax.
Will this bundle work with Laravel’s asset pipelines (Vite, Webpack, Mix) for unused CSS/JS detection?
Not out of the box, but you can parse `mix-manifest.json` or Vite’s asset manifests to map files to routes. The bundle’s core file-traversal logic can be repurposed, but you’d need to exclude dynamically generated assets (e.g., API routes) to avoid false positives.
What Laravel versions are compatible with a modified Ghost Hunter Bundle?
The bundle requires PHP 8.0+, so Laravel 8.x+ is compatible. However, Symfony dependencies (e.g., `symfony/console`) may need Laravel alternatives like `illuminate/console`. Test thoroughly, as Blade parsing and asset pipelines vary across Laravel versions.
How can I exclude vendor or test-specific files from unused-file reports?
Modify the bundle’s file-filtering logic to skip directories like `vendor/`, `tests/`, or `node_modules/`. For Laravel, add custom rules in the adapted wrapper to ignore `resources/js` (if using frontend frameworks) or `storage/framework/views` (compiled Blade cache).
Are there false-positive risks in Laravel due to dynamic routing (e.g., API resources)?
Yes, dynamic routes (e.g., API resource controllers) or Blade components reused across views may trigger false positives. Mitigate this by whitelisting known dynamic paths or integrating with Laravel’s route cache (`bootstrap/cache/routes.php`) to validate file usage.
Can I integrate Ghost Hunter Bundle’s reports into Laravel’s CI/CD (e.g., GitHub Actions)?
Yes, adapt the bundle’s CLI output to JSON or Markdown for API integration or Slack alerts. Use Laravel’s `Artisan` commands to trigger scans in CI, then parse results with PHPUnit or custom scripts. Example: `php artisan ghosthunter:scan --format=json > unused_files.json`.
What’s the performance impact of running static analysis on large Laravel apps (10K+ files)?
Static analysis can be slow for large projects, but you can optimize by scanning incrementally (e.g., only modified files since last run) or using Laravel’s `File` facade with caching. Test with a subset of files first to gauge performance before full deployment.
Are there Laravel-native alternatives to Ghost Hunter Bundle for unused file detection?
Yes, consider `barryvdh/laravel-debugbar` (for route/template insights), `spatie/laravel-analytics` (for usage tracking), or custom scripts using `laravel-blade-compiler` + `symfony/var-dumper`. For assets, tools like `laravel-mix`’s `manifest` or `vite-plugin-purgecss` can auto-purge unused files.
How do I maintain a Laravel-adapted Ghost Hunter Bundle if the original Symfony version updates?
Fork the repository and use a plugin architecture to isolate Laravel-specific changes (e.g., Blade parsers, asset manifest logic). Monitor the original bundle’s changelog and test updates in a staging environment. Consider contributing back Symfony-agnostic improvements to the upstream project.
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.
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel