Skip to content
Lint the added php code from git-diff
Python Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Build Status

Git php lint

Git php lint is a Python library which lints the PHP code added to git versioning system. Lets assume you add a few lines of code or add a new file to your project. Before doing any versioning (adding, committing, etc.), you can run the git-php-lint command to check for syntax errors.

Minimal requirements

Make sure PHP, Python3 and GIT are installed.


Clone this repo in your machine, then run the following commands

python3 install


Basic usage - linting the added PHP code to existing project files.

This command will lint ONLY your newly added bits of code and not the entire file.


File linting - linting the entire file

This commands will lint the newly added bits of code (see above) plus the newly added files, untracked by git.

git-php-lint --file-lint

Debugging the PHP code

You can see a preview of newly added code and the line numbers. Useful for debugging the error message from lint.

git-php-lint --debug

Compare added code with a git branch

git-php-lint --with-branch=origin/master

The origin/master is the default. You can change it to whatever branch you need.


git-php-lint -h
git-php-lint --help


Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.



You can’t perform that action at this time.