GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - allysonsilva/php-pre-commit: :octocat: Git pre-commit hook designed for any PHP projects

BranchesTags
Open more actions menu

Latest commit

 

History

7 Commits
7 Commits

Folders and files

NameName
Last commit message
Last commit date
LICENSE
LICENSE
 
 
README.md
README.md
 
 
pre-commit
pre-commit
 
 

Repository files navigation

PHP pre-commit

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.

Dependencies

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 (PHPMD + PHPCBF)

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.

PHP Coding Standards Fixer (PHP-CS-Fixer)

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.

PHP Mess Detector (PHPMD)

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.

PHP Copy/Paste Detector (PHPCPD)

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

License

MIT License

About

:octocat: Git pre-commit hook designed for any PHP projects

Topics

automationdevelopmentgitgit-hookphpphp-cs-fixerphpcbfphpcpdphpcsphpmdscript

Resources

Readme
MIT license
Activity

Stars

47 stars

Watchers

3 watching

Forks

25 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.