Change the name of the Laravel application

Posted on

As shown as in the title of the article, “Change the name of the Laravel application”, the main purpose is to change the name of the laravel powered web-based application in a correct way. The correct way in this context is to change the name without having any side effect or without having any bug, error or failures.

The place which is needed to be changed in order to change the name of the application which is based or is powered by Laravel framework is actually located in the .env file configuration. Below is the output which is point out the location of the .env file in a tree format using the ‘tree’ command :

user@hostname:/var/www/html/laravel-project$ tree -aL 1 .
├── app
├── artisan
├── bootstrap
├── composer.json
├── composer.lock
├── config
├── database
├── db
├── .env
├── .env.example
├── .gitattributes
├── .gitignore
├── gulpfile.js
├── logs
├── nbproject
├── package.json
├── phpunit.xml
├── public
├── resources
├── routes
├── server.php
├── storage
├── temporary
├── tests
└── vendor

14 directories, 12 files

Edit the file .env located in root folder of the laravel web-based application with any editor utility and edit the following line :


This is the default display with the above APP_NAME setting in the .env file :


It can be presented and it is presented without any bug or error as shown above.  But if the APP_NAME value is changed into a value contains space, the Laravel powered web-based app will display blank page. Below is the example of the value contains the space value :

APP_NAME=Infrastructure Management System.

The display of the web-based application powered by Laravel framework will be shown as follows :

Another way to make it available with a long one consisting of several words separated by a blank space is to enclose it in a double quote as follows :

APP_NAME="Infrastructure Management System."

In the actual blade view template file, the variable itself is printed in a blade view template file by calling it in as shown below :

<title>{{ env('APP_NAME') }}</title>

It means the title of the page in the blade view template file is set to a value which is retrieved from an environment variable APP_NAME defined in the .env file.

One thought on “Change the name of the Laravel application

Leave a Reply