Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Steve Azzopardi:
Setting up GrumPHP with Laravel
Aug 02, 2016 @ 17:17:11

On his Medium blog Steve Azzopardi has a tutorial showing you how to install and use the GrumPHP tool to evaluate the quality of the code in your Laravel-based codebase.

First of lets go through what is GrumPHP and how it can help in our workflow to make pull requests less “Code Check Styles” and more proper architecture review. There are specifically built tools for code style checks such as nitpick or styleCI, but even tools like these will only help you after you push your code to GitHub. GrumPHP will do all the style checks and other tasks, such as run PHPunit before you do a commit.

He expects a few prerequisites to already be installed but they're pretty minimal (basically Composer and Git). He then makes a brand new Laravel application and (optionally) sets up a development environment in a Vagrant VM. Next he pulls in GrumPHP and executes it, showing the happy green "grump" as there's no code defined to test. Next he adds in PSR-2 format testing with PHP_CodeSniffer and shows the unhappy red "grump" that results from bad code. He then adds in PHPUnit testing and adds in a gulp task to load other required resources.

tagged: grumphp testing laravel tutorial installation configuration

Link: https://medium.com/@steveazz/setting-up-grumphp-with-laravel-202f158e9862#.id38p25bs

Cees-Jan Kiewiet:
Run GrumPHP git hooks within Vagrant
Jun 07, 2016 @ 17:22:11

Cees-Jan Kiewiet has a post on his site showing you how to run GrumPHP hooks in Vagrant, a tool that allows for code quality evaluation.

A couple of weeks back while attending AmsterdamPHP Mike Chernev gave a talk about GrumPHP. Very cool looking tool, but during implementation I found out it the default setup assumes running grumphp on the same machine (whether that is a VM or iron) as committing. That is a problem in my set up where all PHP related code runs in vagrant and comitting on the host using PHPStorm. Lets fix that.

The post includes the scripts you'll need to include in your Vagrant setup to execute the quality checks on commit, pre-commit and the Vagrant hook setup to run everything inside of the VM instead of locally.

tagged: grumphp hooks git vagrant commit

Link: https://blog.wyrihaximus.net/2016/06/run-grumphp-git-hooks-within-vagrant/


Trending Topics: