Skip to content

A Visual Studio Code extension that refactors deprecated PHP functions and outdated code practices.

License

Notifications You must be signed in to change notification settings

tomastt123/php-legacy-refactor

Repository files navigation

PHP Legacy Refactor

PHP Legacy Refactor
A VS Code extension and CLI tool that scans PHP projects for deprecated functions and suggests modern alternatives.

πŸš€ Easily identify and refactor outdated PHP code to improve compatibility with the latest PHP versions.

πŸ”“ This is an open-source project – everyone is welcome to contribute, improve, and expand its functionality!


πŸ“Ί Demo Video

πŸŽ₯ Demo GIF A short video demonstrating how the tool works in VS Code and CLI mode.


πŸ–ΌοΈ Screenshots

CLI Output Example

CLI Example
CLI Example

VS Code Extension in Action

VS Code Extension
A screenshot showing deprecated functions highlighted in VS Code.


🌟 Features

βœ… Detects deprecated PHP functions in your project.
βœ… Suggests modern replacements for outdated functions.
βœ… Works as a CLI tool and a VS Code extension.
βœ… Provides quick fixes in VS Code for seamless refactoring.
βœ… Uses an external deprecatedMappings.json for easy updates.
βœ… Fully customizable – modify deprecatedMappings.json to tailor replacements to your needs!
βœ… Open-source – contribute to the project and help improve it!


πŸ“¦ Installation

1️. Clone the Repository

git clone https://github.com/yourusername/php-legacy-refactor.git
cd php-legacy-refactor

2. βš™οΈ Customizing the Deprecated Functions List

The deprecatedMappings.json file contains all deprecated functions and their suggested replacements. You can edit this file to:

Add new deprecated functions Modify replacements to fit your coding style Remove any functions you don't want flagged Example snippet from deprecatedMappings.json:

{ "each": "foreach", "split": "explode", "join": "implode", "ereg": "preg_match" }

πŸ“Œ Simply update this file, and the CLI tool & VS Code extension will use your custom mappings.

3. πŸ› οΈ Contributing

This project is open-source, and contributions are welcome!

Fork the repository Create a new branch (feature-new-check or bugfix-fix-xyz) Make your changes and commit Submit a pull request Any contributions, from bug reports to feature improvements, are appreciated!

4. πŸ“œ License

This project is licensed under the MIT License – you're free to use, modify, and distribute it.

πŸ“Œ If you find this tool useful, give it a ⭐ on GitHub!

About

A Visual Studio Code extension that refactors deprecated PHP functions and outdated code practices.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published