What is Yii Yii is a highperformance, componentbased PHP framework for developing largescale Web applications rapidly. It enables maximum reusability in Web programming and can significantly accelerate your Web application development process. The name Yii (pronounced Yee or ji:) is an acroynym for Yes It Is. This is often the accurate, and most concise response to inquires from those new to Yii: Is it fast? ... Is it secure? ... Is it professional? ... Is it right for my next project? ... Yes, it is 1. Requirements To run a Yiipowered Web application, you need a Web server that supports PHP 5.1.0. For developers who want to use Yii, understanding objectoriented programming (OOP) is very helpful, because Yii is a pure OOP framework. 2. What is Yii Best for? Yii is a generic Web programming framework that can be used for developing virtually any type of Web application. Because it is lightweight and equipped with sophisticated caching mechanisms, it is especially suited to hightraffic applications, such as portals, forums, content management systems (CMS), ecommerce systems, etc. 3. How does Yii Compare with Other Frameworks? Like most PHP frameworks, Yii is an MVC framework. Yii excels other PHP frameworks at being efficient, featurerich and clearlydocumented. Yii is carefully designed from the ground up to be fit for serious Web application development. It is neither a byproduct of some project nor a conglomerate of thirdparty work. It is the result of the authors rich experience with Web application development and their investigation of the most popular Web programming frameworks and applications
Trang 1CREATE PHP PROJECT WITH Yii Framework
Author: Rãnh Rỗi
What is Yii
Yii is a high-performance, component-based PHP framework for developing large-scale Web applications rapidly It enables maximum reusability in Web programming and can significantly accelerate your Web application development process The name Yii
(pronounced Yee or [ji:]) is an acroynym for "Yes It Is!" This is often the accurate, and most concise response to inquires from those new to Yii:
Is it fast? Is it secure? Is it professional? Is it right for my next project? Yes, it is!
1 Requirements
To run a Yii-powered Web application, you need a Web server that supports PHP 5.1.0 For developers who want to use Yii, understanding object-oriented programming (OOP)
is very helpful, because Yii is a pure OOP framework
2 What is Yii Best for?
Yii is a generic Web programming framework that can be used for developing virtually any type of Web application Because it is light-weight and equipped with sophisticated caching mechanisms, it is especially suited to high-traffic applications, such as portals, forums, content management systems (CMS), e-commerce systems, etc
3 How does Yii Compare with Other Frameworks?
Like most PHP frameworks, Yii is an MVC framework
Yii excels other PHP frameworks at being efficient, feature-rich and clearly-documented Yii is carefully designed from the ground up to be fit for serious Web application
development It is neither a byproduct of some project nor a conglomerate of third-party work It is the result of the authors' rich experience with Web application development and their investigation of the most popular Web programming frameworks and
applications
Trang 2Installation
Installation of Yii mainly involves the following two steps:
1. Download Yii Framework
from yiiframework.com
2. Unpack the Yii release file to a Web-accessible directory.
To run a php page you also need to install php into your machine In this case, i’m using Xampp ( Wamp is also like Xampp, try it if you want, it just a litle different).
1. Download Xampp from http://www.apachefriends.org/en/xampp-windows.html.
2. Remember the PHP version of Xampp that you are using.
3. Install Remember you should only install xampp into this directory C:/xampp
Creating Your First Yii Application
Run yiic on the command line as follows:
% YiiRoot/framework/yiic webapp WebRoot/duansample
With:
YiiRoot : the directory of your Yii
WebRoot: the directory where you want to save you project
duansample: your project name (whatever you want)
When you hit enter, system will promt you choose [Yes/No] to ask you want to create project in that directory or not (this mean create in WebRoot)
Press Y and Enter
Your project have been created Yeah!
Trang 3Test your project
Now, you want to show up your new project in web browser
So, after install Xampp, you will see this directory C:\xampp\htdocs
Copy your project into this directory
Open your project folder and edit file index.php
You will see this line:
“$yii=dirname( FILE ).'/ /yii.php';
Now, we modify the [/ /yii.php'] for it point to yii.php
In your Yii folder, you will see yii.php in this directory YiiRoot\framework
With me, to convenience, i copy my yii folder into project folder, that mean i copy it into this location : C:\xampp\htdocs\[project_name]\
Then, the
“$yii=dirname( FILE ).'/ /yii.php';
will be modified to this ->
$yii=dirname( FILE ).'/yii/framework/yii.php';
Now, let see your result:
1. Open browser
2. Try this http://localhost/[project_name]/index.php