How to create a new Yii application?

by cortez.connelly , in category: PHP Frameworks , a year ago

How to create a new Yii application?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by ryan.murray , a year ago


To create a new Yii application, you can follow these steps:

  1. Install Yii on your system by running the following command in your terminal or command prompt:
composer global require "fxp/composer-asset-plugin:^1.4.2"
composer create-project --prefer-dist yiisoft/yii2-app-basic basic

  1. Change into the newly created basic directory:
cd basic

  1. Initialize the application by running the following command:
php init

This will prompt you to choose an environment for your application (development, production, or testing). Choose the appropriate option and follow the prompts to complete the initialization.

  1. Create a new database for your application and update the database configuration in config/db.php with the appropriate database credentials.
  2. Run the following command to apply the migrations:
php yii migrate

This will create the necessary database tables for your application.

  1. Start the built-in web server by running the following command:
php yii serve

This will start the server and your application should now be accessible at http://localhost:8080/.

That's it! You now have a new Yii application up and running.