Developers are quickly switching from older frameworks like CodeIgniter to Yii, which allows for quicker deployment of PHP web applications. Here are some steps to get started with Yii on Mac:

  1. Download the Yii framework.
  2. Unarchive the download, enter your command line of choice, and run chmod -R 755 on the directory to make the necessary files accessible and executable.
  3. cd into the framework folder and run this command:

    $ yiic webapp your/htdocs/location
    
    • Now you’ve created a “skeleton” for your web application. Start up your Apache server, if you haven’t already, and open the webpage that you chose before. Ex: http://localhost/your/location/index.php.

    • You should see the Yii welcome page. Now open your/location/protected/config/main.php in your text editor and add this to the configuration:

      return array(
          ......
          'import'=>array(
              'application.models.<em>',
              'application.components.</em>',
          ),
              
          'modules'=>array(
              'gii'=>array(
                  'class'=>'system.gii.GiiModule',
                  'password'=>'enter-a-password-here',
              ),
          ),
      );
      
    • Point your web browser to http://localhost/your/location/index.php?r=gii and open the Model Generator.

    • Use Yii to generate code for a model with the Table Name tbl_user and the Model Class User.
    • In the sidebar, select the CRUD Generator to generate code to implement CRUD operations. Create code for the Model Class User and the Controller ID user. Once again preview and generate the code.
    • Now, if you open http://localhost/your/location/index.php?r=user in your web browser, you should see a list of all the entries in the default tbl_user database table.
    • Go to http://localhost/your/location/index.php?r=user/admin (the admin function of the user class) and log in using the gii password you choose earlier (in the main configuration file). From here, you can perform the various CRUD operations such as listing, editing, and creating entries in the database.

    Yii allows for the quick development of PHP applications by simplifying processes such as writing code to perform CRUD operations by generating the code for you.