I'm making in use of a library that expects to receive a native PHP array such as is obtained from the global $_REQUEST.
Unfortunately in this instance, the Illuminate\Http\Request is an object, and seems to have quite a different structure to the native php array. Is there a method to convert that object to the same array that would be obtained via '$_REQUEST' (which doesn't work inside a laravel controller method).
Thanks in advance.
Laravel's Illuminate\Http\Request class provides an object-oriented way to interact with the current HTTP request being handled by your application as well as retrieve the input, cookies, and files that were submitted with the request.
Laravel provides an expressive, minimal API around the Guzzle HTTP client, allowing you to quickly make outgoing HTTP requests to communicate with other web applications.
rs. Path annotation in JAX-RS is used to define a URI matching pattern for incoming HTTP requests. It can be placed upon a class or on one or more Java methods.
Illuminate\Http\Request has some nice methods to turn it into arrays.
// Where $request is an Illuminate\Http\Request instance
$request->all(); // Returns array with all elements.
$request->only(['key1', 'key2']); // Returns array with selected items
$request->except(['key1']); // Returns array with everything except key1.
You should always check the class for methods you can use. Just browse through the files and see what they have to offer. It's fun and gives you a better understanding of the api.
Laravel really shines with its extensive documentation, make sure you take advantage of it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With