on laravel, there is a specific class named Illuminate\Http\Request which provided an object-oriented way to interact with HTTP request which are send by client-side
it can be accessed by two methods as follows,
$name = $request->input('name');
$name = $request->name;
which one is the most efficient way to get the request?
>Solution :
The first one with input() is the mainly documented way of doing it, so I’d recommend using it as the functionnality is quite well established and the behavior is quite known.
The second one is a syntaxic sugar that map unexisting properties to inputs. It may be more concise however it uses a magic method call that will be potentially slower (check that a property exist, recognise it doesn’t, resolve the magic call and execute the magic call).
However, while the performance difference is quite negligible for most usages imho, I’ll not recommend using the second method anyway. As the Request class scemantics may change in future versions, you have no guarantee that a property will not be created with the same name as an input used in your application. This may or may not create bugs when upgrading the framework down the line as all your code will now be referencing this property instead of the inputed value as you intend it to.