Friday, May 17, 2019

PHP code quality and static code analysis tools


There are multiple tools exists to improve PHP code quality and static code analysis. Due to varied in nature, configure these tools in PHP project is many a time troublesome.

Solution is Docker. Docker image to configure PHP code quality and static code analysis. Being a PHP developer, some of us might not familiar with Docker.

As per Wikipedia, the Docker is a collection of interoperating software-as-a-service and platform-as-a-service offering that employ operating-system-level virtualization to cultivate development and delivery of software inside standardized software packages called container.

Being a developer, you do not need to worry about how Docker work in our operating system. The most important thing is to know how we can increase productivity and goodies using Docker.

Let me give some glance of Docker and its applicability in PHP web development.

I have released PHP code quality and static code analysis project

This project you can use to analyze your code. It is single source of truth for various code quality related tools.

To use this project you need to install Docker in your OS.

Brief about Code quality and static analysis tools

PhpMetrics: PhpMetrics provides various metrics about PHP projects. You should visit demo project to get an understanding about this tool capability.

PHP Code Sniffer: PHP Code Sniffer 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. The PHP CodeSniffer is an essential development tool that ensures your code remains clean and consistent. Refer

PHPStan: PHP Static Analysis Tool - discover bugs in your code without running it. To get more details about this tool, refer  https://github.com/phpstan/phpstan


No comments:

Post a Comment