'Laravel class usage guide? [closed]
I am a PHP beginner and learning Laravel (currently Laravel 9). I have seen some tutorials, and I am experimenting with them. I noticed that there are many classes defined in the framework itself. I want to know whether there is a guide explaining the implementation and usage of these classes.
For example, there are Illuminate\Http\Response and Illuminate\Support\Facades\Response classes. Both seem to have the same usage, but I could be wrong.
There are some other questions, too, like a global namespace response() which creates a new response instance, so why would I use Illuminate\Http\Response or Illuminate\Support\Facades\Response to create a new instance?
Are there any guides where it specifies when, where, and why we would use those classes? Are there any rules for such situations?
I also couldn't find a complete guide for handling audio files and creating an audio player before finding the solution here in ronline's answer.
Solution 1:[1]
You can find more information about the Laravel classes in the API. In the case of Illuminate\Http\Response and Illuminate\Support\Facades\Response, you can find them here:
https://laravel.com/api/master/Illuminate/Http/Response.html https://laravel.com/api/master/Illuminate/Support/Facades/Response.html
If you want more info on the difference between Illuminate\Http\Response and Illuminate\Support\Facades\Response, the facade doesn't have the header method. This is answered here (in the comments):
Laravel 5.2- Call to undefined method Illuminate\Support\Facades\Response::header()
This website seems to give more information on response objects:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jurian van der Woude |
