Skip to main content

4 posts tagged with "composer"

View All Tags

Docker image that provides static analysis tools for PHP

ยท 6 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Docker image that provides static analysis tools for PHP

For years now, I'm using https://github.com/jakzal/phpqa to run a lot of static analysis tools on my PHP codebase.

The list of available tools is huge; see by yourself: Available tools.

In this blog post, we will see how we can take advantage of all these tools and increase the quality of our scripts.

Install a PHP Docker environment in a matter of seconds

ยท 4 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Install a PHP Docker environment in a matter of seconds

This article is the very short and straightforward version of PHP development in a devcontainer with preinstalled code quality tools. If you just want to follow a very few steps and get your PHP environment, this article is for you.

By following steps describe in this article, you'll obtain:

  • A Docker PHP environment so you can code using vscode,
  • The PHP composer package manager installed,
  • A few static analysis tool like php-cs-fixer, phpcs, phpcbf, sonarlint and Rector installed
  • A devcontainer ready-to-use environment.

Just follow the guide...

The aim of this article is to create a development environment (aka devcontainer)

Please refers to my other articles about Docker to see how to Dockerize the application and be able to run the application using Apache and a database service like PostgreSQL.

Rector 1.0.0 ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰, my friend, my coach

ยท 6 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Rector 1.0.0 ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰, my friend, my coach

If there was only one, it would be Rector. Rector is extremely powerful and brilliant and, you know what, it's free!

Rector is a tremendous application to scan and automatically upgrade your codebase to a given version of PHP and this means, too, to inspect how you're coding.

Rector will look at every line of code, every loop, every conditional test, every function, every class in a PHP source code and suggest improvements.

In this role, it will not only detect improvements to my code (like a static analysis tool) but, and this is the biggest advantage for me, it will show me how I can become a better developer.

I REALLY LOVE RECTOR ๐Ÿ’•

PHP development in a devcontainer with preinstalled code quality tools

ยท 22 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

PHP development in a devcontainer with preinstalled code quality tools

Don't want to read this long article

Let's imagine one of the following situations:

  1. You are working with several people on the same PHP project and you notice that one or other person does not comply with your quality criteria when it comes to the layout of the code. You like to use four spaces for indentation, you want the brace that marks the start of a function to be on the line, you don't want to see any more useless spaces at the end of the line, ... and damned! you notice that some people don't care about this.

  2. You are working alone on a project and don't want to lose time to configure your VSCode experience. You wish to start very quickly with a lot of tools already installed in VSCode so you can put your focus to the code, not the editor.

The ultimate solution: using a devcontainer in VSCode.

By using a devcontainer, you (and your team colleague) will use a preinstalled environment and everyone will have exactly the same. You'll save yourself a lot of time by not having to configure your system, and you'll be able to start coding straight away, supported by a range of quality analysis tools.