I'm using Laravel v9.4 with PHP v8.2 and I wanted to install Image Intervention package on my project, so I ran:
composer require intervention/image
But I get this error:
PHP Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traver
sable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/
symfony/console/Helper/HelperSet.php on line 112
So what's going wrong here?
The problem is on the composer itself. Update your composer using this command: composer global update
Related
I've been asked on my job to update a Laravel 6 project to version 9. I'm having a lot of issues, i can't even test the project cause it's giving me a lot of errors.
First i wanted to check the exact laravel version (i've been told it's 6.2), but I can't even check it with php artisan --version or use php artisan...
Also I would like to know how to do the update, since i can only find enough information to update from 8 to 9 on the official website.
Thanks.
Things i've tried:
-Changed this on composer.json:
"require": {
"php": "^7.3|^8.0",
.....
},
-Tried this composer commands:
composer update
composer install
composer update --no-scripts
composer require laravel/framework
-I get this errors:
During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with Arr
ayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\Users*******\
Documents\Project\project\vendor\laravel\framework\src\Illuminate\Support\Collection.php:1277
or
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
Thanks.
I've been able to upgrade laravel 6 to 7 with success.
The first problem was that my PHP version was too high, apparently higher versions does not work for the upgrade, so I had to downgrade PHP (im using Xampp so i just had to change 'apache' and 'php' folders on Xampp folder from 7.2.5 version).
My project had some external dependencies that I had to upgrade first before running 'composer update'. This was the main problem and I didn't know about that. (In my case barryvdh/laravel-ide-helper and laravel/ui).
After I fixed that things, I just ran 'composer update' and everything was working. I'll try to upgrade now to laravel 8 and 9, hope it's the same. Thanks to everyone for the answers and hope this can help others.
I am using the ReallySimpleJWT Library and I have changed the server and reinstalled the libraries with Composer again. Only this library gave an error and I don't understand why.
What could be the problem?
2022/01/03 22:28:51 [error] 2739#2739: *1635 FastCGI sent in stderr:
"PHP message: PHP Fatal error: Uncaught Error: Call to undefined
method ReallySimpleJWT\Token::validateExpiration() in
/var/.......php:23
Line 23:
$result = Token::validateExpiration($token, $secretForToken);
What could be the cause of this error?
Composer:
web2#serve:/var/www/.../panel$ composer require rbdwllr/reallysimplejwt
Using version ^3.1 for rbdwllr/reallysimplejwt
./composer.json has been updated
Running composer update rbdwllr/reallysimplejwt
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Package easyframework/collections is abandoned, you should avoid using it. No replacement was suggested.
Package easyframework/generics is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
36 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
What could be the cause of this error?
The static method your are trying to access on the Token
class does not exist.
This is the log of heroku, previous version of my code was running perfect but I change some code and have this error.
Rollback is no t solution same error now...
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/php
-----> PHP app detected
-----> Bootstrapping...
-----> Installing platform packages...
- php (8.1.0)
- ext-mbstring (bundled with php)
- composer (2.1.14)
- apache (2.4.51)
- nginx (1.20.2)
-----> Installing dependencies...
PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::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 /tmp/build_3007ab05/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1349
I got the exact same error recently. My local php version is 8.0.13 and it is working fine, but when I uploaded it to heroku (the php version used here is 8.1) I got the error.
To solve the problem, I specified my php version in the composer.json to the exact same local php version that I'm using like this:
{
"require": {
"php": "8.0.13"
}
}
Don't forget to update the composer.lock, then upload it to heroku. Heroku will use that exact version.
I know it is not recommended to specify the exact version per https://devcenter.heroku.com/articles/php-support, but it is working fine as a workaround.
hi guys I need help for this case
I can't run laravel 5.7 on php8, when I do "php artisan serve"
I got error:
thrown in /var/www/html/myProject/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 838
PHP Fatal error: Uncaught ErrorException: Method ReflectionParameter::getClass() is deprecated in /var/www/html/myProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:838
I have tried to update composer required php version form "^7.1.3" to "php": "^7.1.3|^8.0",
and when I run composer update I got another error.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/framework[v5.7.0, ..., 5.7.x-dev] require php ^7.1.3 -> your php version (8.0.3) 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 hope any body sharing what is solution for this case
Both errors are related.
According to The Official Docs Laravel 5.7 only supports PHP >= 7.1.3.
Trying to force it to run on PHP8 will cause some funky things as PHP8 has a lot of game changing fixes/migrations/deprecation. All of which can be found here.
If you want to use PHP8, use Laravel 8. If you want to use Laravel 5.7, use PHP7.
If you must use PHP8 and Laravel 5.7, I suggest you change the composer requiremnet to "php": "^8.0", but be prepared to troubleshoot a lot.
Laravel 5.7 is not compatible with PHP 8. If you want to get PHP 8 support, make sure you're at the latest version of Laravel 6, 7, or 8.
There are also a couple of commonly used dependencies you'll need to update in your composer.json file:
PHP to php:^8.0
Faker to fakerphp/faker:^1.9.1
PHPUnit to phpunit/phpunit:^9.3
You can putting exit($e); in App\Exceptions\Handler::report() to give a better error message.
delete vendors file
then run the command composer install
I installed Composer successfully and now I'm trying to install Symfony 2 on a Macbook 10.5.8.
I downloaded Symfony Standard 2.5.0 (.tgz) on http://symfony.com/download and I tried to use the create-project command to generate a new Symfony application using
php composer.phar create-project symfony/framework-standard-edition path/to/install
but I get this error:
Fatal error: Class 'Phar' not found in /Users/jenisawesome/composer.phar on line 13
Maybe it's because I have an old php version? I'm not sure. I can't even run Composer when I type in this command:
php composer.phar
I get the same error:
Fatal error: Class 'Phar' not found in /Users/jenisawesome/composer.phar on line 13
Based on discussion in the comments, this error appears to be because you're using PHP 5.2. Composer required at least 5.3.2 to run.
Aside from that, this question appears to be a duplicate of PHP: Class 'Phar' not found