Interface 'Psr\Http\Message\RequestFactoryInterface' not found

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
CraigNel
User
Posts: 30

Interface 'Psr\Http\Message\RequestFactoryInterface' not found

Post by CraigNel »

I have updated composer to the latest version

Now when i generate and view the project i get the following error

Fatal error: Interface 'Psr\Http\Message\RequestFactoryInterface' not found in C:\xampp\htdocs\sb\vendor\nyholm\psr7\src\Factory\Psr17Factory.php on line 14

Has anyone come across this and have any recommendations for me.


arbei
User
Posts: 9292

Post by arbei »

You may try to delete the "vendor" folder and composer.json in the project folder and enable "Composer update" in PHPMaker to make Composer run update and create the "vendor" folder again. (Make sure you use the latest version, v2021.0.3, as of today.)


CraigNel
User
Posts: 30

Post by CraigNel »

Hi.

That folder is not being produced

I have the following
container
http-message
http-server-handler
http-server-middleware
log


CraigNel
User
Posts: 30

Post by CraigNel »

HI all.

I have got it working.

You can't do a manual install of composer. You need to:

Install composer on windows (Using the windows install file). Then navigate to C:\ProgramData\ComposerSetup\bin and replace the composer.phar with version 1.10.16.
Restart the computer.
Run cmd and enter: Composer clearcache
Open Phpmaker 2021
Navigate to tools, clear template cache.
now regenerate your project with the composer update enabled.. (remember to delete the project generation)


Webmaster
User
Posts: 9425

Post by Webmaster »

Bug of Composer v2.0.0-2.0.2. Composer v2.0.3 (released on 2020/10/28) has fixed the problem.


Lazar
User
Posts: 13

Post by Lazar »

Great, it works. Thank You !


Roland
User
Posts: 24

Post by Roland »

I have the same problem:

Fatal error: Uncaught Error: Interface 'Psr\Http\Message\RequestFactoryInterface' not found in C:\Xampp\htdocs\caleven\vendor\nyholm\psr7\src\Factory\Psr17Factory.php:16

using PhpMaker 2022.8.0 on Xampp (PHP Version 7.4.27)

Checking composer, I got

C:\Xampp\htdocs\caleven>composer -V
Composer version 2.2.1 2021-12-22 22:21:31

C:\Xampp\htdocs\caleven>composer update
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
Generating autoload files
12 packages you are using are looking for funding.
Use the composer fund command to find out more!

C:\Xampp\htdocs\caleven>

Checking vendor\composer\autoload_static.php, I just have (lines 152-155)

    'Psr\\Http\\Message\\' => 
    array (
        0 => __DIR__ . '/..' . '/psr/http-message/src',
    ),

It works with composer.phar version 1.10.16.

Any help would be very appreciated.


arbei
User
Posts: 9292

Post by arbei »

For unknown reason Composer v2.2.x removes psr/http-factory so the interface 'Psr\Http\Message\RequestFactoryInterface' not found.

It seems that Composer v2.2.3 has fixed the issue, there is no need to downgrade Composer, you may open a command prompt and update composer itself by entering:

composer selfupdate


lopezjorgel
User
Posts: 1

Post by lopezjorgel »

I recently installed PHPMaker ver2021.0.15 for the first time on my Windows 11 PC and get the same error. Composer is up to date. I have tried just about everything suggested in this post without success. Always get the following error

Fatal error: Interface 'Psr\Http\Message\RequestFactoryInterface' not found in H:\OneDrive\Veronica\My Documents\inetpub\wwwroot\eduxys.com\httpdocs\reports\prfipr2022\vendor\nyholm\psr7\src\Factory\Psr17Factory.php on line 16.

Any suggestions appreciated.


arbei
User
Posts: 9292

Post by arbei »

lopezjorgel wrote:

Fatal error: Interface 'Psr\Http\Message\RequestFactoryInterface' not found in H:\OneDrive\Veronica\...'

Avoid generating to OneDrive (e.g. X:\OneDrive\...) or other mapped drive in which you may not have write permission.

After generation, make sure:

  1. You can run composer without errors (open command prompt and run composer -V),
  2. You have generated composer.json and run "composer update" without errors,
  3. The "vendor" folder is generated under the project folder,
  4. You upload all generated scripts and the "vendor" folder to your development/production server.

You should also enable Debug and check for any PHP errors in the log files.


philmills
User
Posts: 535

Post by philmills »

I hit a similar error:
Uncaught Error: Interface "Psr\Http\Message\UriFactoryInterface" not found in /[path]/vendor/nyholm/psr7/src/Factory/Psr17Factory.php
Got it all working now.
I had my project files stored on a mapped drive and couldn't update composer via CMD there.
Moving the project, updating composer, then regenerating files fixed the issue


Post Reply