Saturday, May 28, 2022
HomeWordPress DevelopmentUtilizing GrumPHP, Composer 2 and PHP 7.2

Utilizing GrumPHP, Composer 2 and PHP 7.2


I’m very a lot a fan of GrumPHP which I’ve written extensively about in beforehand posts.

And as my final previous alluded, I’ve been adapting a chunk of software program so it maximizes its availability throughout all platforms utilizing PHP no matter now new or how outdated the platform is (at the very least between PHP 7.2 and PHP 8).

Right here’s the factor, although: Should you’re working with an older model of PHP then you definitely’re going to wish an older model of GrumPHP and when you’re going to make use of an older model, you might want an older model of Composer.

Besides possibly not!

GrumPHP, Composer 2 and PHP 7.2

As soon as of the nicest issues about Composer 2 is how a lot sooner its develop into. So it raises a query: Is there a model of the packages that we’re utilizing that concurrently work with older variations of PHP (like PHP 7.2) and nonetheless work with Composer 2?

With some packages, no. Sadly, it’s important to fall again to Composer 1. But when in any respect doable, use Composer 2. And fortuitously, when you’re utilizing GrumPHP and Composer 2, there is a model of the library that works with Composer 2.

What actually received my began on all of this was the next message:

  Drawback 1
    - Root composer.json requires phpro/grumphp v0.8.0 -> satisfiable by phpro/grumphp[v0.8.0].
    - phpro/grumphp v0.8.0 requires composer-plugin-api ~1.0 -> discovered composer-plugin-api[2.3.0] but it surely doesn't match the constraint.

Be aware that I used to be operating PHP 7.2 and Composer 2 whereas looking for a model of GrumPHP that helps Composer 2. It’s a tedious process however right here’s what you want:

  1. Composer 2
  2. PHP 7.2
  3. GrumPHP v0.18.1

This permit GrumPHP to work with libraries that may sniff out points along with your codebase all of the whereas working with Composer 2.

I don’t know if different variations will do that, however I do know that this model works. This implies my composer.json appears to be like like this (nicely, a part of it at the very least):

"require-dev": {
    "phpro/grumphp": "v0.18.1",
    "squizlabs/php_codesniffer": "^3.5",
    "phpcompatibility/php-compatibility": "^9.3.5",
    "sensiolabs/security-checker": "^4.0"
},

Then within the terminal when you run:

~ composer replace

You need to see the same old suggestions you count on (which ought to both be All Good or the choice 🙂).

So when you’re wanting to make use of GrumPHP, Composer 2, and PHP 7.2, that is the way you make it occur efficiently.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments