Closed stefanoruth closed 8 years ago
I had this same problem and had to pull in the following package in my compose.json.
"symfony/psr-http-message-bridge": "0.2",
Please read the suggested dependencies printed on the screen on composer install.
Why would the message-bridge be needed for raw mail? It doesn't suggest that at all, also the docs don't mention that?
@barryvdh I doubt it is. I think the error was unrelated.
@GrahamCampbell It's due to the use of Guzzle.
That's not true. I use guzzle to send emails without this dependency. It sounds like the wrong request class is getting resolved by mistake here.
I also had this error: Class 'Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory' not found
Traced back to: https://github.com/laravel/framework/blob/5.3/src/Illuminate/Routing/Router.php#L1015 ...where the HttpFoundationFactory class is used.
At line 17 in this Router class the HttpFoundationFactory class is imported: "use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory;"
But I had to require "symfony/psr-http-message-bridge" first to make it work... is this really a 'suggested' dependency and not a required one?
laravel/framework suggests installing symfony/psr-http-message-bridge (Required to use psr7 bridging features (0.2.*).)
It is suggested indeed after composer install/update. But why is this not a requirement?
It is: https://laravel.com/docs/5.3/requests#psr7-requests
The PSR-7 standard specifies interfaces for HTTP messages, including requests and responses. If you would like to obtain an instance of a PSR-7 request instead of a Laravel request, you will first need to install a few libraries. Laravel uses the Symfony HTTP Message Bridge component to convert typical Laravel requests and responses into PSR-7 compatible implementations:
composer require symfony/psr-http-message-bridge composer require zendframework/zend-diactoros
Thank's for the clarification!
It is: https://laravel.com/docs/5.3/requests#psr7-requests
The PSR-7 standard specifies interfaces for HTTP messages, including requests and responses. If you would like to obtain an instance of a PSR-7 request instead of a Laravel request, you will first need to install a few libraries. Laravel uses the Symfony HTTP Message Bridge component to convert typical Laravel requests and responses into PSR-7 compatible implementations: composer require symfony/psr-http-message-bridge composer require zendframework/zend-diactoros
Thanks, @barryvdh! You saved my day. Now I wonder why it not comes installed with Laravel -> Guzzle by default, or it is another thing at all?
Now, I found an issue. When testing, I did hardcode the whole path to the file and worked fine. But when put into variables, it couldn´t find the file, like showing below:
fopen(CNH.pdf): failed to open stream: No such file or directory
Found the DIR method. It gets the path, but still wrong because i´m inside Lavarels app:
$response = $client->request('POST', 'http://gedocflex.com.br:8003/api/file', [ 'headers' => [ 'Content-Type' => 'multipart/form-data', ], 'multipart' => [ [ 'name' => 'idTematica', 'contents' => '202' ], [ 'name' => 'f', 'contents' => fopen(__DIR__ . $request->file, 'r') ], [ 'name' => 'field1',
problem still exists. i've tried to install required packages and fresh install of laravel 8. still says:
Class "Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory" not found
Try:
composer require symfony/psr-http-message-bridge
Laravel version 5.2.39
Just tried to use Mail::raw(); setup with a mailgun configuraion and the mail works fine and i revice it but i still gets the error any idears to whats missing?