Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory' not found Laravel passport

Viewed 2990

Hello everyone i'm using sfelix-martins/passport-multiauth Based on laravel passport

  • I'm getting this error
{message: "Class 'Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory' not found",…}
message: "Class 'Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory' not found"
exception: "Error"
file: "/app/vendor/smartins/passport-multiauth/src/Facades/ServerRequest.php"
line: 17
trace: [,…]
  • This is my Composer
"require": {
    "php": "^7.2.5",
    "fideloper/proxy": "^4.2",
    "fruitcake/laravel-cors": "^1.0",
    "guzzlehttp/guzzle": "^6.5",
    "laravel/framework": "^7.0",
    "laravel/tinker": "^2.0",
    "laravel/ui": "^2.0",
    "smartins/passport-multiauth": "^6.0",
    "symfony/psr-http-message-bridge": "^2.0"
},

NB: When i put this file (DiactorosFactory.php) in the directory from my older laravel project it's work perfectly.

2 Answers

As you can see in Readme.md: https://github.com/symfony/psr-http-message-bridge/blob/26068fa40d91305529cb168997c0b528bb6eef07/CHANGELOG.md

using DiactorosFactory is deprecated and was removed with version 2.0.0

Deprecated DiactorosFactory, use PsrHttpFactory instead

You will find a solution how to replace that in your code here: https://github.com/sfelix-martins/passport-multiauth/pull/123/files#diff-b37981c79b4592847e664547ec085670454b57df4d701cd6218930b55169930fR17-R24

The official documentation how to use the new stuff you will find here: https://symfony.com/doc/current/components/psr7.html#usage

It looks like that package fixed the issue in their next version (7.0). If you upgrade to the newest version, that'll fix your issue.

If you can't upgrade that package, then your other option is to downgrade symfony/psr-http-message-bridge to version ^2.0. This will also downgrade laravel/passport to version 8.4.0.

Related