Laravel Artisan General Command: The name Command

December 7, 2016 —John Koster

The app:name command can be used to set the application namespace. It accepts only one argument, the new name of the application namespace. In a new Laravel installation, the application namespace is set to App, as can be seen in the following code snippet (both PHP code examples will use the contents of the default file app/Http/Controllers/Controller.php):

1<?php
2 
3namespace App\Http\Controllers;
4 
5// Rest of file contents omitted.

After running the following artisan command:

1php artisan app:name LaravelArtisan

the file changes to the following (note the namespace changes):

1<?php
2 
3namespace LaravelArtisan\Http\Controllers;
4 
5// Rest of file contents omitted.

Some absolutely amazing
people

The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.