so i tried to install composer and laravel into Phpstorm, but right now there seems to be a problem installing the composer.json
file in php. PHP
version is 7.4.8
. The error code is as shown below.
"./composer.json" does not match the expected JSON schema:
- name : Does not match the regex pattern ^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$
I tried to look it up for help but it didnt get me far enough, so I was wondering if anyone could help me out with this problem.
this is how my composer.json looked like.
{
"name": "vendor_name/PhpProjec",
"description": "description",
"minimum-stability": "stable",
"license": "proprietary",
"authors": [
{
"name": "***",
"email": "[email protected]"
}
],
"require": {
"barryvdh/laravel-ide-helper": "v2.7.0"
}
5
Answers
Are you probably using Composer v2? When I use the given JSON in my local environment using Composer v1, it tells me:
The error message you’ve provided does not occur on my system. If you are still facing problems after using another package name, please share more details
composer is case sensitive from v1.9 onwards…
so change "PhpProject" to "phpproject"
The problem is in the "name" property
Change the "name" property accordingly "vendor-name/project-name"
eg:
"name": "nismi/my-php-project"
Easy fix go to
composer.json
file find where is capitalizised e.g Izupay/PayMent to izupay/payment this will fix the error.Working answer is:
This most likely has to do with the version of Composer you’re using.
Before Composer version 2.0, a name could contain any character, including white spaces.
However, from version 2.0 upwards:
vendor_name/PhpProjec
, it would bevendor_name/phpprojec