Yii2 Change name "My Yii Application"

How I can change Yii2 application name"My Yii Application"

Where I update this code of line?

Yii::$app->name

update your code in views/layouts/main.php

By default line no 34




            NavBar::begin([

                'brandLabel' => Yii::$app->name,



Add below code in web.php




$config = [

    'id' => 'basic',

	'name'=>'Test App',



1 Like

from config, change id.

in basic: web.php, change id

To correctly change the name of your app you need to edit the config/main.php (if your using the advanced app you will need to change the frontend and backbend config/main.php files).




<?php

return [

	'id' => 'app-frontend',

'name'=>'Your New Name!',

....other...info



Other items you can configer in the main.php file

Then you can use it wherever with


Yii::$app->name

2 Likes

I have installed yii2 basic. I changed name in web.php but nothing happened.

Working now … !!




<?php

return [

        'id' => 'basic',

'name'=>'Your New Name!',

....other...info



1 Like

And what you have done for that new result? :face_with_raised_eyebrow: I have the same problem but your post was unuseful…

Now I understand, people like me can mix up console.php and web.php files. Be smart and modify web.php

Update in main.php config file.

image

Add a name parameter in both frontend and backend config/ main file as shown below:

return [
‘id’ => ‘app-frontend’,
‘name’ => ‘Trip Management System’, // this one
‘basePath’ => dirname(DIR),

    ],