Scisr is an imperfect but simple refactorer. It is written in and for PHP.
I like to pronounce “Scisr” with a hard ‘c’ sound.
Scisr is imperfect. Because PHP is weakly and dynamically typed, a refactorer will never make the right decision in every imaginable case. Scisr accepts this limitation and settles for trying to do the thing that is most likely to be right. When in doubt, Scisr errs on the side of caution.
Scisr is simple. Scisr doesn’t tell you how to structure your work. Scisr assumes you are doing smart things like using a version control system and testing the changes Scisr makes, but it doesn’t try to dictate those parts of the process. Scisr sticks to doing what Scisr does best.
Rename a class
$ scisr rename-class OldName NewName [files]
Rename a class, changing all references to that class in your code and PHPDoc.
Rename a class method
$ scisr rename-method OwningClassName oldMethodName newMethodName [files]
Rename a class method. Tries to guess variable types so as to only rename methods called on objects of the correct class.
--no-inheritance Do not rename method in descendants of the given class.
Rename a file
$ scisr rename-file old/file_name new/dir/new_file_name [files]
Rename a file, and try to modify require and include statements appropriately.
At the current time, this command is a bit simplistic in which filenames it will detect.
Rename a class and containing file
$ scisr rename-class-file OldClassName NewClassName [files]
Rename a class, and rename the class’ file if the name matches (for example, a class named Foo in Foo.php, or a class named Foo_Bar_Baz in Foo/Bar/Baz.inc).
The last arguments to
scisr are any number of directory or file names. These designate the code to be refactored.
-t, --timid Do not make changes to the files, just list filenames with line numbers. -a, --aggressive Make changes even when we're not sure they're correct. -e<extensions>, --extensions=<extensions> Specify a comma-separated list of allowed file extensions. -i<patterns>, --ignore=<patterns> Specify a comma-separated list of patterns used to ignore directories and files. -h, --help Print usage instructions.
You will need PHP 5.2.x with the PDO Extension installed.
Currently Scisr probably only works on Unix-like systems.
- Download Scisr.
- You can run Scisr right from the folder where you unpacked it. Or, if you’d prefer, you can move
scisrto somewhere in your executable path, and move everything else to a PHP include directory.
Report Bugs / Request Features
If you find a bug or would like to request a feature, please open an issue through GitHub.
GPL Version 3
Scisr is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Scisr is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
For more details, see http://www.gnu.org/licenses/gpl.html.