a9f / lifter
Tool for automating project upgrades using Rector and other tools
Requires
- php: ^8.2
- a9f/fractor: ^0.3
- rector/rector: ^1.0
- symfony/config: ^6.4 || ^7.0
- symfony/console: ^6.4 || ^7.0
- symfony/dependency-injection: ^6.4 || ^7.0
- symfony/process: ^6.4 || ^7.0
- symfony/yaml: ^6.4 || ^7.0
- thecodingmachine/safe: ^2.5
Requires (Dev)
- ergebnis/composer-normalize: ^2.42
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^11.0
- symplify/easy-coding-standard: ^12.1
- thecodingmachine/phpstan-safe-rule: ^1.2
This package is auto-updated.
Last update: 2024-12-16 15:24:36 UTC
README
Lifter is a powerful tool designed to automate software updates for PHP projects. Leveraging the capabilities of tools like Composer and Rector, Lifter simplifies the process of updating dependencies and migrating code to newer versions.
Whether you're a developer managing multiple projects or part of a team working on a large codebase, Lifter streamlines the update process, saving time and reducing the risk of errors.
Features
- Automated Dependency Updates: Lifter automates the process of updating dependencies specified in your composer.json file, ensuring that your project stays up-to-date with the latest versions.
- Code Migration with Rector: Integrating with Rector, Lifter facilitates smooth migration of code when updating to newer versions of libraries or frameworks. Rector automates code refactoring, making it easier to adopt best practices and utilize new features.
- Customizable Configuration: Lifter offers flexible configuration options, allowing you to tailor the update process to fit your project's specific requirements. Customize which dependencies to update, configure Rector rules, and more.
Getting Started
Follow these steps to start using Lifter in your PHP project:
-
Installation: Install Lifter via Composer by running the following command:
$ composer require a9f/lifter
-
Configuration: Create a lifter.php configuration file in the root of your project. Here's a basic example:
return static function (\a9f\Lifter\Configuration\LifterConfig $config) { $config->withWorkingDirectory(__DIR__) ->withRectorBinary('vendor/bin/rector') ->withRectorConfigFile(__DIR__ . '/rector.php'); $config->withSteps([ new \a9f\Lifter\Upgrade\Step\ShellStep( 'Add Hello World', <<<SCRIPT DATE=$(date +%s) echo "Hello World" | tee \$DATE.txt git add \$DATE.txt SCRIPT ), new \a9f\Lifter\Upgrade\Step\RectorStep( 'Apply PHP 8.3 set list', static function (\Rector\Config\RectorConfig $rectorConfig) { $rectorConfig->sets([ \Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_83, ]); } ) ]); };
-
Usage: Run Lifter from the command line in your project directory:
$ vendor/bin/lifter run -f lifter.php
This command will apply the steps you specified in your
lifter.php
in the order in which they appear in the file.Each step will lead to a separate Git commit. By default, Lifter will prefix the commit message with
(lifter)
to make its work easier to spot in the history.To change this prefix, call
$config->withCommitMessagePrefix('my prefix:');
. To get rid of the prefix, pass an empty string.
Contributing
If you encounter any issues or have suggestions for improvements, we welcome contributions from the community. Here's how you can contribute:
- Fork the repository.
- Make your changes.
- Submit a pull request with a clear description of your changes and why they are needed.
Support
For any questions or support regarding Lifter, please open an issue on GitHub. We'll do our best to assist you promptly.
License
Lifter is licensed under the MIT License.
Acknowledgments
Lifter wouldn't be possible without the amazing work of the Composer and Rector teams. We're grateful for their contributions to the PHP ecosystem.
Thank you for using Lifter to streamline your software update process! We hope it helps make your development workflow more efficient and enjoyable. If you have any feedback or suggestions, we'd love to hear from you.
Happy coding! 🚀