Giter Club home page Giter Club logo

php-pre-commit's Introduction

GIT pre-commit script appropriate for any PHP project. A pre-commit script that validates syntax errors in PHP. It also validates PHP files against PSR2 coding styles.

About

This is a pre commit script that checks added, copied, modified or renamed files for syntax errors and PSR2 coding standards.

Installation

  1. git clone this repository.
  2. Copy the pre-commit file to your project's Git hooks folder. Make sure that the pre-commit file is executable.
# Put the pre-commit file in the .git/hooks/ folder in your git repository.
curl -O https://raw.githubusercontent.com/AllysonSilva/php-pre-commit/master/pre-commit

# create new hooks folder
mkdir .git/hooks

# move pre-commit to new hooks folder
mv pre-commit .git/hooks/pre-commit

# don't forget to make the pre-commit file executable
chmod +x .git/hooks/pre-commit

Usage

This will work automatically before every commit.

PHP Lint(Syntax check)

A bash script that runs php -l against stage files that are php. Assumes php is a global executable command. Will exit when it hits the first syntax error.

PHP_CodeSniffer is a set of two PHP scripts; the main phpcs script that tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard, and a second phpcbf script to automatically correct coding standard violations. PHP_CodeSniffer is an essential development tool that ensures your code remains clean and consistent.

It will assume that there is a valid PHP Code Sniffer executable at these locations, vendor/bin/phpcs, phpcs or php phpcs.phar.

The PHP Coding Standards Fixer (PHP CS Fixer) tool fixes your code to follow standards; whether you want to follow PHP coding standards as defined in the PSR-1, PSR-2, etc., or other community driven ones like the Symfony one.

PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. PHPMD can be seen as an user friendly frontend application for the raw metrics stream measured by PHP Depend.

phpcpd is a Copy/Paste Detector (CPD) for PHP code.

License

MIT License

php-pre-commit's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.