I have set the application name using
php artisan app:name xyz
How can I progmatically access 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 ?
If you want to get this variable form .env file:
You get that way:
If you want to get another variable, for example APP_ENV, just write:
To get application namespace:
To get application name:
There's
Illuminate\Console\AppNamespaceDetectorTrait
which you can use. Add this in your class:And then you can use it anywhere in that class with
$this->getAppNamespace()
From laravel version 5.3^ there is a function to call the app name
You can change the default name 'Laravel' inside this file
And also inside .env file