I have a problem when I run composer update
for any project in laravel. It give me this error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires php ^7.1.3 but your php version (8.1.0) does not satisfy that requirement.
Problem 2
- laravel/framework[v5.7.0, ..., 5.7.x-dev] require php ^7.1.3 -> your php version (8.1.0) does not satisfy that requirement.
- Root composer.json requires laravel/framework 5.7.* -> satisfiable by laravel/framework[v5.7.0, ..., 5.7.x-dev].
I tried to change it from composer.json but still doesn’t works
also I tried to composer install --ignore-platform-reqs
gives me other error which is :
Generating optimized autoload files
Class EguliasEmailValidatorExceptionExpectedQPair located in C:/laravel/job-portal-website-in-laravel-master/vendor/egulias/email-validator/EmailValidatorExceptionExpectingQPair.php does not comply with psr-4 autoloading standard. Skipping.
> IlluminateFoundationComposerScripts::postAutoloadDump
Deprecation Notice: Return type of IlluminateContainerContainer::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:laraveljob-portal-website-in-laravel-mastervendorlaravelframeworksrcIlluminateContainerContainer.php:1204
Deprecation Notice: Return type of IlluminateContainerContainer::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:laraveljob-portal-website-in-laravel-mastervendorlaravelframeworksrcIlluminateContainerContainer.php:1215
Deprecation Notice: Return type of IlluminateContainerContainer::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:laraveljob-portal-website-in-laravel-mastervendorlaravelframeworksrcIlluminateContainerContainer.php:1227
Deprecation Notice: Return type of IlluminateContainerContainer::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:laraveljob-portal-website-in-laravel-mastervendorlaravelframeworksrcIlluminateContainerContainer.php:1240
> @php artisan package:discover
Deprecated: Return type of IlluminateContainerContainer::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:laraveljob-portal-website-in-laravel-mastervendorlaravelframeworksrcIlluminateContainerContainer.php on line 1204
Deprecated: Return type of IlluminateContainerContainer::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:laraveljob-portal-website-in-laravel-mastervendorlaravelframeworksrcIlluminateContainerContainer.php on line 1215
Deprecated: Return type of IlluminateContainerContainer::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:laraveljob-portal-website-in-laravel-mastervendorlaravelframeworksrcIlluminateContainerContainer.php on line 1227
Deprecated: Return type of IlluminateContainerContainer::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:laraveljob-portal-website-in-laravel-mastervendorlaravelframeworksrcIlluminateContainerContainer.php on line 1240
Deprecated: Method ReflectionParameter::getClass() is deprecated in C:laraveljob-portal-website-in-laravel-mastervendorlaravelframeworksrcIlluminateContainerContainer.php on line 833
Deprecated: Method ReflectionParameter::getClass() is deprecated in C:laraveljob-portal-website-in-laravel-mastervendorlaravelframeworksrcIlluminateContainerContainer.php on line 907
Deprecated: Method ReflectionParameter::getClass() is deprecated in C:laraveljob-portal-website-in-laravel-mastervendorlaravelframeworksrcIlluminateContainerContainer.php on line 833
Deprecated: Method ReflectionParameter::getClass() is deprecated in C:laraveljob-portal-website-in-laravel-mastervendorlaravelframeworksrcIlluminateContainerContainer.php on line 907
Deprecated: Return type of IlluminateConfigRepository::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:laraveljob-portal-website-in-laravel-mastervendorlaravelframeworksrcIlluminateConfigRepository.php on line 141
Deprecated: Return type of IlluminateConfigRepository::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:laraveljob-portal-website-in-laravel-mastervendorlaravelframeworksrcIlluminateConfigRepository.php on line 152
Deprecated: Return type of IlluminateConfigRepository::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[ReturnTypeWillChange] attribute shou......ect.
so do you have idea how should I mage that error? can someone help???
4
Answers
Solved !! I used global composer with XAMPP server for php.
Your php version is too high (8.1). Laravel 5.x is not compatible with php 8.
You have two options here:
You have upgraded your php version in your machine. So, to let your laravel application know that I have upgraded to newer version of php do following,
In you
root
directory opencomposer.json
file and inrequire
object there is php version mentioned. Change it to following.If this does not work then just use only current php version installed on your machine.
in my case: my laravel 8.9
i try to use ^8.8
then run composer u
everything ok