<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Adrian M</title>
    <description>The latest articles on Forem by Adrian M (@adrmrn).</description>
    <link>https://forem.com/adrmrn</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F564006%2F0cb4ca87-86fa-4423-9115-f14ee75ad2f1.jpeg</url>
      <title>Forem: Adrian M</title>
      <link>https://forem.com/adrmrn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/adrmrn"/>
    <language>en</language>
    <item>
      <title>How I take care of code quality with GrumPHP</title>
      <dc:creator>Adrian M</dc:creator>
      <pubDate>Sat, 30 Jan 2021 20:13:30 +0000</pubDate>
      <link>https://forem.com/adrmrn/how-i-take-care-of-code-quality-with-grumphp-4do5</link>
      <guid>https://forem.com/adrmrn/how-i-take-care-of-code-quality-with-grumphp-4do5</guid>
      <description>&lt;p&gt;Everyone knows how important is taking care of code quality in our projects. There's a lot of ways to do that - code reviews, code standards or unit tests. Some responsibilities can be handled by some static analysis tools. I'm pretty sure you have heard about &lt;strong&gt;PHPStan&lt;/strong&gt;, &lt;strong&gt;PHP Code Sniffer&lt;/strong&gt; or &lt;strong&gt;PHPMD&lt;/strong&gt;. Configuration of each in the project might be awkward.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/phpro/grumphp"&gt;&lt;strong&gt;GrumPHP&lt;/strong&gt;&lt;/a&gt; keeps all-in-one configuration for all most popular tools. &lt;em&gt;"This composer plugin will register some git hooks in your package repository. When somebody commits changes, GrumPHP will run some tests on the committed code"&lt;/em&gt;. The library has a lot of built-in tasks and you can start using them with few lines of configuration.&lt;/p&gt;

&lt;p&gt;I would like to show you how to implement GrumPHP in project. So, let's get started.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(TL;DR version can be found at the end of the article)&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ✩ &lt;strong&gt;GrumPHP installation&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Go to your project, open a terminal and install GrumPHP via composer command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require &lt;span class="nt"&gt;--dev&lt;/span&gt; phpro/grumphp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When composer asks you to create a &lt;code&gt;grumphp.yml&lt;/code&gt; file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Do you want to create a grumphp.yml file? &lt;span class="o"&gt;[&lt;/span&gt;Yes]:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;just type &lt;code&gt;No&lt;/code&gt;, we’re going to create the configuration manually.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Watch out! GrumPHP is sniffing your commits!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Good, looks like the package is installed.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✩ &lt;strong&gt;GrumPHP configuration&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To start using GrumPHP we need &lt;code&gt;grumphp.yml&lt;/code&gt; file. Let's create that file with minimal configuration in root directory of your project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# grumphp.yml&lt;/span&gt;

&lt;span class="na"&gt;grumphp&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;tasks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As I mentioned before, GrumPHP is run on every single commit. But there is a way to run checks manually when needed. Let's just run binary file from a composer vendor&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./vendor/bin/grumphp run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the terminal you should noticed a grummy man's face. He will supervise your code quality, so watch out!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;             ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
           ▄▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌           
         ▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌
        ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌
        ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌        
  ▄▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌
 ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌        
 ▐█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌        
   ▀█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌        
     ▀▀▓▓▓▓▓▓▓▓▓▓▓▓█▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████████▄
      ▄████████▀▀▀▀▀                 ██████████   
     ███████▀                         ██████▀
      ▐████      ██▌          ██       ████▌      
        ▐█▌                            ███        
         █▌           ▄▄ ▄▄           ▐███        
        ███       ▄▄▄▄▄▄▄▄▄▄▄▄       ▐███         
         ██▄ ▐███████████████████████████
        █▀█████████▌▀▀▀▀▀▀▀▀▀██████████▌▐         
          ███████████▄▄▄▄▄▄▄███████████▌          
         ▐█████████████████████████████           
          █████████████████████████████           
           ██ █████████████████████▐██▀           
            ▀ ▐███████████████████▌ ▐▀            
                ████▀████████▀▐███                
                 ▀█▌  ▐█████  ▐█▌                 
                        ██▀   ▐▀                  
       _    _ _                         _ _
      / &lt;span class="se"&gt;\ &lt;/span&gt; | | |   __ _  ___   ___   __| | |
     / _ &lt;span class="se"&gt;\ &lt;/span&gt;| | |  / _&lt;span class="sb"&gt;`&lt;/span&gt; |/ _ &lt;span class="se"&gt;\ &lt;/span&gt;/ _ &lt;span class="se"&gt;\ &lt;/span&gt;/ _&lt;span class="sb"&gt;`&lt;/span&gt; | |
    / ___ &lt;span class="se"&gt;\|&lt;/span&gt; | | | &lt;span class="o"&gt;(&lt;/span&gt;_| | &lt;span class="o"&gt;(&lt;/span&gt;_&lt;span class="o"&gt;)&lt;/span&gt; | &lt;span class="o"&gt;(&lt;/span&gt;_&lt;span class="o"&gt;)&lt;/span&gt; | &lt;span class="o"&gt;(&lt;/span&gt;_| |_|
   /_/   &lt;span class="se"&gt;\_\_&lt;/span&gt;|_|  &lt;span class="se"&gt;\_&lt;/span&gt;_, |&lt;span class="se"&gt;\_&lt;/span&gt;__/ &lt;span class="se"&gt;\_&lt;/span&gt;__/ &lt;span class="se"&gt;\_&lt;/span&gt;_,_&lt;span class="o"&gt;(&lt;/span&gt;_&lt;span class="o"&gt;)&lt;/span&gt;
                  |___/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ok, now we can setup some tasks and checks.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✩ &lt;strong&gt;PHP CodeSniffer (PHPCS)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;What is &lt;a href="https://github.com/squizlabs/PHP_CodeSniffer"&gt;PHP CodeSniffer&lt;/a&gt;?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's install required dependency with the composer&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require &lt;span class="nt"&gt;--dev&lt;/span&gt; squizlabs/php_codesniffer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Based on &lt;a href="https://www.php-fig.org/psr/"&gt;PSR&lt;/a&gt;, currently &lt;a href="https://www.php-fig.org/psr/psr-12/"&gt;PSR-12&lt;/a&gt; is a recommended coding standard. &lt;/p&gt;

&lt;p&gt;Let's add PHP CodeSniffer task and determine standard in our configuration file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# grumphp.yml&lt;/span&gt;

&lt;span class="na"&gt;grumphp&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;tasks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;phpcs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;standard&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;PSR12&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, commit your changes (or run manually GrumPHP) to check your code for the first time.&lt;/p&gt;

&lt;p&gt;Oops... GrumpPHP found some issues related to PSR12 standard so take a look on a message that points the file and brings more information about the error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;FILE: .../src/User.php
&lt;span class="nt"&gt;---------------------------------------------------------------&lt;/span&gt;
FOUND 1 ERROR AFFECTING 1 LINE
&lt;span class="nt"&gt;---------------------------------------------------------------&lt;/span&gt;
 27 | ERROR | &lt;span class="o"&gt;[&lt;/span&gt;x] Expected 1 newline at end of file&lt;span class="p"&gt;;&lt;/span&gt; 0 found
&lt;span class="nt"&gt;--------------------------------------------------------------------&lt;/span&gt;

I can fix some stuff automatically, &lt;span class="k"&gt;do &lt;/span&gt;you want me to? &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;yes&lt;/span&gt;/no&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;no]:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are two options to resolve these errors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;go to the file and fix them manually, or&lt;/li&gt;
&lt;li&gt;trust GrumPHP and allow it to fix them automatically. To do so type &lt;code&gt;yes&lt;/code&gt; in the terminal.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Auto-Fixing tasks...
Running fixer 1/1: phpcs... ✔

&lt;span class="o"&gt;[&lt;/span&gt;WARNING] Please review the code changes that I made!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember, you should review all the changes made by the tool.&lt;/p&gt;

&lt;p&gt;Great! Now the project is consistent with PSR12 standard, that’s a good start. &lt;/p&gt;

&lt;h2&gt;
  
  
  ✩ &lt;strong&gt;PHPStan&lt;/strong&gt;
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;The &lt;a href="https://github.com/phpstan/phpstan"&gt;PHPStan&lt;/a&gt; task focuses on finding errors in your code without actually running it. It catches whole classes of bugs even before you write tests for the code&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Install a required dependency by running the composer command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require &lt;span class="nt"&gt;--dev&lt;/span&gt; phpstan/phpstan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, add PHPStan as one of tasks in the configuration file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# grumphp.yml&lt;/span&gt;

&lt;span class="na"&gt;grumphp&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;tasks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;phpcs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;standard&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;PSR12&lt;/span&gt;
    &lt;span class="na"&gt;phpstan&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;level&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are 9 levels of checks from 0 to 8, where 0 is the loosest and 8 is the strictest. Which one should you choose? It depends.&lt;/p&gt;

&lt;p&gt;If you are working with a legacy code or you are just starting to take care of your code quality - choose between 0 and 3. You can always upgrade the level in the future. &lt;/p&gt;

&lt;p&gt;When you are confident with your codebase and skills then I recommend choosing levels from 4 to 8.&lt;/p&gt;

&lt;p&gt;Run GrumPHP. If there are some errors, you will see a message that may look like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;phpstan
&lt;span class="o"&gt;=======&lt;/span&gt;

&lt;span class="nt"&gt;-----------&lt;/span&gt; &lt;span class="nt"&gt;--------------------------------------------------------------------&lt;/span&gt; 
  Line   src/User.php                                                        
 &lt;span class="nt"&gt;------&lt;/span&gt; &lt;span class="nt"&gt;--------------------------------------------------------------------&lt;/span&gt; 
  21     Method User::id&lt;span class="o"&gt;()&lt;/span&gt; should &lt;span class="k"&gt;return &lt;/span&gt;string but returns int.  
 &lt;span class="nt"&gt;------&lt;/span&gt; &lt;span class="nt"&gt;--------------------------------------------------------------------&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unfortunately, all the fixes have to be done manually.&lt;/p&gt;

&lt;p&gt;It looking good, we have installed two tasks already.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✩ &lt;strong&gt;PHPUnit&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;(If you don’t use &lt;a href="https://github.com/sebastianbergmann/phpunit"&gt;PHPUnit&lt;/a&gt; in your project, skip this section)&lt;/p&gt;

&lt;p&gt;I used to forgot running tests before committing my changes. Sometimes after that, a build on my pipeline failed.&lt;/p&gt;

&lt;p&gt;To be sure unit tests always pass, let's add PHPUnit task to GrumPHP.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# grumphp.yml&lt;/span&gt;

&lt;span class="na"&gt;grumphp&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;tasks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;phpcs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;standard&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;PSR12&lt;/span&gt;
    &lt;span class="na"&gt;phpstan&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;level&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;
    &lt;span class="na"&gt;phpunit&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;always_execute&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because as a rule unit tests are executed really fast, set &lt;code&gt;always_execute&lt;/code&gt; as &lt;code&gt;true&lt;/code&gt;. It means unit test will be run on every commit. Thanks to that, if any test fails, GrumPHP will inform us about that incident.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;phpunit
&lt;span class="o"&gt;=======&lt;/span&gt;

PHPUnit 9.X.X by Sebastian Bergmann and contributors.

...

FAILURES!
Tests: 2, Assertions: 2, Failures: 1.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I would like to show you one more interesting and useful tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✩ &lt;strong&gt;Security Checker&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Nowadays, everyone uses the composer and external dependencies. Libraries very often become affected by vulnerabilities and it's difficult to track changelog of them all.&lt;/p&gt;

&lt;p&gt;GrumPHP and &lt;a href="https://github.com/enlightn/security-checker"&gt;Security Checker&lt;/a&gt; can help to detect dangerous packages you use.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;The Security Checker will check your composer.lock file for known security vulnerabilities.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's install the required dependency&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require &lt;span class="nt"&gt;--dev&lt;/span&gt; enlightn/security-checker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add task to &lt;code&gt;grumphp.yml&lt;/code&gt; file and set &lt;code&gt;run_always: true&lt;/code&gt; flag. It means that on every commit all dependencies will be checked by tool.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# grumphp.yml&lt;/span&gt;

&lt;span class="na"&gt;grumphp&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;tasks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;phpcs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;standard&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;PSR12&lt;/span&gt;
    &lt;span class="na"&gt;phpstan&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;level&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;
    &lt;span class="na"&gt;phpunit&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;always_execute&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
    &lt;span class="na"&gt;securitychecker&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;run_always&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run GrumPHP and check the result.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;securitychecker
&lt;span class="o"&gt;===============&lt;/span&gt;

Symfony Security Check Report
&lt;span class="o"&gt;=============================&lt;/span&gt;

1 packages have known vulnerabilities.

guzzlehttp/guzzle &lt;span class="o"&gt;(&lt;/span&gt;6.2.0&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nt"&gt;------------------------------&lt;/span&gt;

 &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;CVE-2016-5385][]: HTTP Proxy header vulnerability

&lt;span class="o"&gt;[&lt;/span&gt;CVE-2016-5385]: https://github.com/guzzle/guzzle/releases/tag/6.2.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see above, there is pointed package with vulnerability that have to be updated.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✩ &lt;strong&gt;Summary&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;All looks good, four tasks passed successfully. It's a good first step towards better code quality in your project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Running task 1/4: phpcs... ✔
Running task 2/4: phpstan... ✔
Running task 3/4: phpunit... ✔
Running task 4/4: securitychecker... ✔
             ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
           ▄▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌           
         ▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌
        ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌
        ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌        
  ▄▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌
 ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌        
 ▐█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌        
   ▀█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌        
     ▀▀▓▓▓▓▓▓▓▓▓▓▓▓█▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████████▄
      ▄████████▀▀▀▀▀                 ██████████   
     ███████▀                         ██████▀
      ▐████      ██▌          ██       ████▌      
        ▐█▌                            ███        
         █▌           ▄▄ ▄▄           ▐███        
        ███       ▄▄▄▄▄▄▄▄▄▄▄▄       ▐███         
         ██▄ ▐███████████████████████████
        █▀█████████▌▀▀▀▀▀▀▀▀▀██████████▌▐         
          ███████████▄▄▄▄▄▄▄███████████▌          
         ▐█████████████████████████████           
          █████████████████████████████           
           ██ █████████████████████▐██▀           
            ▀ ▐███████████████████▌ ▐▀            
                ████▀████████▀▐███                
                 ▀█▌  ▐█████  ▐█▌                 
                        ██▀   ▐▀                  
       _    _ _                         _ _
      / &lt;span class="se"&gt;\ &lt;/span&gt; | | |   __ _  ___   ___   __| | |
     / _ &lt;span class="se"&gt;\ &lt;/span&gt;| | |  / _&lt;span class="sb"&gt;`&lt;/span&gt; |/ _ &lt;span class="se"&gt;\ &lt;/span&gt;/ _ &lt;span class="se"&gt;\ &lt;/span&gt;/ _&lt;span class="sb"&gt;`&lt;/span&gt; | |
    / ___ &lt;span class="se"&gt;\|&lt;/span&gt; | | | &lt;span class="o"&gt;(&lt;/span&gt;_| | &lt;span class="o"&gt;(&lt;/span&gt;_&lt;span class="o"&gt;)&lt;/span&gt; | &lt;span class="o"&gt;(&lt;/span&gt;_&lt;span class="o"&gt;)&lt;/span&gt; | &lt;span class="o"&gt;(&lt;/span&gt;_| |_|
   /_/   &lt;span class="se"&gt;\_\_&lt;/span&gt;|_|  &lt;span class="se"&gt;\_&lt;/span&gt;_, |&lt;span class="se"&gt;\_&lt;/span&gt;__/ &lt;span class="se"&gt;\_&lt;/span&gt;__/ &lt;span class="se"&gt;\_&lt;/span&gt;_,_&lt;span class="o"&gt;(&lt;/span&gt;_&lt;span class="o"&gt;)&lt;/span&gt;
                  |___/

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I have introduced you to GrumPHP with a really simple configuration. There is a lot of different tasks that you can use in your project and full list can be found in official GitHub repository: &lt;a href="https://github.com/phpro/grumphp/tree/master/doc/tasks"&gt;GrumPHP Task Docs&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✩ &lt;strong&gt;TL;DR&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Install GrumPHP:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require &lt;span class="nt"&gt;--dev&lt;/span&gt; phpro/grumphp
Do you want to create a grumphp.yml file? &lt;span class="o"&gt;[&lt;/span&gt;Yes]:
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; No
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install dependencies&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require &lt;span class="nt"&gt;--dev&lt;/span&gt; squizlabs/php_codesniffer
composer require &lt;span class="nt"&gt;--dev&lt;/span&gt; phpstan/phpstan
composer require &lt;span class="nt"&gt;--dev&lt;/span&gt; enlightn/security-checker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a file &lt;code&gt;grumphp.yml&lt;/code&gt; in the project's root directory with the following configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# grumphp.yml&lt;/span&gt;

&lt;span class="na"&gt;grumphp&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;tasks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;phpcs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;standard&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;PSR12&lt;/span&gt;       &lt;span class="c1"&gt;# PSR12 is recommended, but there are available i.a. PSR1, PSR2&lt;/span&gt;
    &lt;span class="na"&gt;phpstan&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;level&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;              &lt;span class="c1"&gt;# levels: 0-8, where 0 is the loosest and 8 is the strictest&lt;/span&gt;
    &lt;span class="na"&gt;phpunit&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;                &lt;span class="c1"&gt;# comment those lines if you ...&lt;/span&gt;
      &lt;span class="na"&gt;always_execute&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;  &lt;span class="c1"&gt;# ... don't use PHPUnit in your project&lt;/span&gt;
    &lt;span class="na"&gt;securitychecker&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;run_always&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Commit changes or just run binary file from the composer vendor&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./vendor/bin/grumphp run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;More build-in tasks can be found in official GitHub repository: &lt;a href="https://github.com/phpro/grumphp/tree/master/doc/tasks"&gt;GrumPHP Task Docs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>codequality</category>
    </item>
  </channel>
</rss>
