4

i have googled the usage of "namespace" and "use" keywords in laravel and ended up with no proper explanation. could someone clearly explain the difference between "namespace" and "use" keywords in laravel?

vijay varikol
  • 81
  • 3
  • 10

1 Answers1

5

Simply, namespaces are like the place of the current class. For example if we have a Person class and it is in app folder, it's namespace will be App\Person. And when you want to use that class you should use it by the keyword use. And that will be use App\Person. It will load that class to your current file. There are plenty of information in the internet about it but if you don't like reading docs (which you should), you can search youtube for a tutorial. (Codecourse channel is good for start)