It all started when I just wanted to install Laravel Jetstream and then I faced the Problem with friendsofphp/php-cs-fixer and php 7.3
To install Laravel Jetstream, technically the command is something like this
As soon as I ran the above command, I encountered below issue, which says The “–jet” option does not exist.
This issue comes with the fact that the laravel/installer which I had on my system was v2.0.1 and this version is not capable to create new Laravel project with Jetstream.
Problem with friendsofphp/php-cs-fixer and php 7.3
So, I started looking for answers where I came across this link which says to run below command, which is used to download the Laravel installer using Composer:
composer global require laravel/installer
So the next thing i got was
friendsofphp/php-cs-fixer v2.13.0 requires php ^5.6 || >=7.0 <7.3 -> your PHP version (7.4.11) does not satisfy that requirement.
This was because the Laravel installer tries to install all the dependencies which also includes friendsofphp/php-cs-fixer, which was actually creating a problem. As you can see in the below screenshot, friendsofphp/php-cs-fixer needs php version >= 7.0 but <7.3 and fortunately or unfortunately I had PHP v7.4.11 installed and therefore the problem.
So, without thinking much I started installing PHP v7.2 using
brew install firstname.lastname@example.org
Once PHP v7.2 was installed, I tried the same command again and this time, I got
laravel/installer v4.0.5 requires php ^7.3 -> your PHP version (7.2.33) does not satisfy that requirement.
I also installed PHP v7.3
brew install email@example.com
and tried the same command of laravel/installer and got this
Now I was getting irritated.
So I tried updating the laravel/installer and to add it my frustration it got updated to v2.3.0 from v2.0.1. I wonder why this was not updated to latest version v4.0.5 (as of when this article was written)
I tried one more thing, this time I tried installing friendsofphp/php-cs-fixer and to make more worse, it popped out this problem/issue
After doing all this I was still not having laravel/installer v4 with which I could have started with Laravel Jetstream. By the way to start with Laravel Jetstream
laravel new project-name --jet
this is not the only command, one can definitely do the below and get started – Ref
$ laravel new project-name $ composer require laravel/jetstream
But what I do is, if there are any commands in the any documentation which I am going through I should be able to run all the commands mentioned in the documentation.
Which is wisdom wise not good, because if you are able to install the required packages for your project by any alternative, you must do that and start with project but with this kind of attitude a person like me tends to waste his whole day on this.
So, finally at the end of the day I thought I would write down as an article so that it helps others who too think time is just sitting there for them to complete whatever they are working on and then they can move on with the next task.
Finally, I got the magic command or rather an argument to the same command – here
composer global require friendsofphp/php-cs-fixer --update-with-all-dependencies
So with this command I was able to install friendsofphp/php-cs-fixer package successfully.
Once friendsofphp/php-cs-fixer package was successfully installed, I again tried with composer global require laravel/installer
and Finally, the command from where it actually started.
Hope this was of some help to you, let me know in the comments, Thanks!!
Another article you can have a look at it – https://laravel-news.com/updating-the-laravel-installer