What is Namespaces in Laravel?. The Complete Laravel Developer Course 2023 [Videos].

Namespaces can be defined as a class of elements in which each element has a unique name to that associated class. It may be shared with elements in other classes

Declaration of namespace

The use keyword allows the developers to shorten the namespace.

use <namespace-name>;

The default namespace used in Laravel is App, however a user can change the namespace to match with web application. Creating user defined namespace with artisan command is mentioned as follows −

php artisan app:name SocialNet

Select Git

The namespace once created can include various functionalities which can be used in controllers and various classes.

See All

Comments (476 Comments)

Submit Your Comment

See All Posts

Related Posts

Laravel / Blog

How to install Laravel ?

For managing dependencies, Laravel uses composer. Make sure you have a Composer installed on your system before you install Laravel. In this chapter, you will see the installation process of Laravel.
14-Feb-2022 /15 /476

Laravel / Blog

What is Laravel - Application Structure?

The application structure in Laravel is basically the structure of folders, sub-folders and files included in a project. Once we create a project in Laravel, we get an overview of the application structure as shown in the image here.
14-Feb-2022 /15 /476

Laravel / Blog

How to setup Configuration in Laravel?

n the previous chapter, we have seen that the basic configuration files of Laravel are included in the config directory. In this chapter, let us discuss the categories included in the configuration.
14-Feb-2022 /15 /476