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
Refactor Bundle

Refactor Bundle Laravel Package

abenbachir/refactor-bundle

Laravel bundle that groups refactoring utilities and helpers to aid safe code changes. Provides commands and tooling to modernize and reorganize codebases, streamline maintenance, and support incremental refactors across projects.

View on GitHub
Deep Wiki
Context7

This bundle provide an easy way to refactor your code

Frequently asked questions about Refactor Bundle
Can this bundle handle Laravel-specific refactoring like renaming controllers or service providers without breaking autoloading?
The bundle likely uses PHP AST manipulation (e.g., php-parser) for generic refactoring, but Laravel’s PSR-4 autoloader may require manual mapping. Test with `composer dump-autoload` after refactoring, or wrap operations in a custom Artisan command to handle Laravel’s namespace conventions explicitly. Always run a dry-run first to verify changes.
How do I install and run this bundle in a Laravel project?
Add it as a dev dependency via `composer require abenbachir/refactor-bundle --dev`, then publish its configuration if available. Run commands directly (e.g., `vendor/bin/refactor`) or integrate it into a custom Artisan command. Check the README for Laravel-specific setup steps, as the bundle may not auto-register service providers.
Does this work with Laravel’s caching (e.g., route/model caches) or will I need to clear them manually?
Since the bundle modifies files directly, you’ll need to clear Laravel caches afterward (`php artisan cache:clear`, `php artisan config:clear`, etc.). For safety, run refactors in a CI pipeline or pre-commit hook where cache invalidation is automated. Avoid running it during production traffic.
What Laravel versions are supported, and how do I check compatibility?
The bundle doesn’t specify Laravel version support, so test it against your Laravel version (e.g., 8.0+, 9.x, or 10.x). Ensure its PHP dependencies (e.g., php-parser) align with Laravel’s PHP version requirements. If issues arise, check for Laravel-specific wrappers or fork the project for adjustments.
Can I use this to refactor vendor dependencies or third-party packages safely?
Refactoring vendor code is risky and unsupported by design. The bundle focuses on your project’s codebase. For third-party packages, consider dependency updates or manual edits. Always back up your project and test changes in a staging environment before merging.
Is there a dry-run or backup mode to preview changes before applying them?
The bundle may include a `--dry-run` flag (check the CLI docs), but if not, manually inspect the AST changes or use Git diffs (`git diff`) to review modifications. For critical projects, run refactors in a disposable branch or containerized environment to isolate risks.
How does this handle failures—like corrupted files or syntax errors after refactoring?
The bundle’s failure mode depends on its implementation, but generic AST tools may log errors or halt execution. For Laravel projects, wrap operations in try-catch blocks and roll back changes if needed. Always commit or stash your work before running refactors and verify the project builds afterward.
Are there performance benchmarks for large Laravel codebases (e.g., 50K+ lines of PHP)?
Performance varies based on the refactor’s complexity and the bundle’s underlying AST parser. Test on a subset of your codebase first. For large projects, run refactors incrementally (e.g., per module) or during off-peak hours. Monitor memory usage (`memory_get_usage()`) and consider splitting operations into smaller batches.
Can I integrate this into Laravel’s task scheduling (e.g., run refactors nightly)?
Yes, but proceed with caution. Use Laravel’s scheduler (`php artisan schedule:run`) to trigger a custom Artisan command wrapping the bundle. Enable `--dry-run` mode for initial tests, then gradually phase in live refactors. Log outputs and monitor for failures in your task queue.
What are the alternatives to this bundle for Laravel refactoring?
For Laravel-specific needs, consider PHPStorm’s built-in refactoring tools (with IDE plugins like Laravel Plugin), Rector (for rule-based refactoring), or custom scripts using `php-parser`. For AST-based tools, PhpStorm’s refactorings or the standalone `php-refactor` CLI may offer similar functionality. Evaluate alternatives based on Laravel integration, safety features, and community support.
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor