# 2 – Namespace in Laravel

Tram Ho

1. Statements

namespace Name;
for example: namespace AppControllers;

2. What

Namespace helps create a namespace for functions and classes in programming in general and in PHP in particular.

3. Why

Namespace helps the program distinguish two classes with the same name.
For example, we have 2 files, each file contains a class and these two classes have a similar name. Now when you embed both files in and call the class, the program will immediately report an error. To fix that, we need to declare the namespace for those two classes.
Share the news now

Source : Viblo