Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the application name in laravel?

I have set the application name using

php artisan app:name xyz 

How can I progmatically access the application name in laravel ?

like image 735
Ganesh Ghalame Avatar asked May 05 '15 07:05

Ganesh Ghalame


People also ask

Where is app name Laravel?

Naming Your Application After installing Laravel, you may wish to "name" your application. By default, the app directory is namespaced under App , and autoloaded by Composer using the PSR-4 autoloading standard.

What is App_url in Laravel?

The APP_URL is .env file environment variable for your application base path such as your domain http://example.com or http://localhost/{project name}/public if you should store your front page picture public/images folder then call url('images/{picture name}') 3.

Can I change Laravel project name?

You should use php artisan app:name command to rename your app. It will change namespace in all project files for you. This is the only right way to rename your app.

Where is .env file in Laravel?

In a fresh Laravel installation, the root directory of your application will contain a .env.example file that defines many common environment variables.


1 Answers

From laravel version 5.3^ there is a function to call the app name

config('app.name'); 

You can change the default name 'Laravel' inside this file

config/app.php  'name' => 'Laravel', 

And also inside .env file

APP_NAME=your_app_name 

for latter to work, in config/app.php the line where you set the name should be written like this: 'name' => env('APP_NAME', 'fallback_app_name'),

like image 56
lewis4u Avatar answered Sep 29 '22 04:09

lewis4u