kmgilbert100 kmgilbert100 - 4 months ago 61x
PHP Question

Laravel 5 / Lumen Request Header?

So I am not really sure how to go about this I have tried a few things and I will list one below however what I am trying to do is store information sent in a http request in a PHP variable.

Here is a view from Chrome Postman of me sending the request I want ot send. Note "pubapi" is a "header".

PostMan View

I have been messing around with Lumen requests as you can see documented here ( ) and have tried using the following below to possibly display them but its not working obviously.

echo Request::all();

I am putting this in my controller and I have ...

use Illuminate\Http\Request;

in my controller.

So how could I say store the header I am sending "pubapi" into a php variable in my controller?


Not sure if this will help, however looking at the Laravel frameworks docs I see this trying this throws the same error in my code. So for example I tried the following and reached the same error.

echo Request::header('pubapi');


Try to change the Illuminate\Http\Request to Request.

- use Illuminate\Http\Request;
+ use Request;