You must have your apache/nginx + php + mysql environment built ready.
Install FuelPHP oil command:
1
| $ curl get.fuelphp.com/oil | sh
|
MySQL:
1
| $ mysqladmin -u root create fuel_dev
|
Config:
modify fuel/app/config/development/db.php with correct settings
Use oil command:
1
2
3
4
5
6
| $ oil create blog
$ cd blog
$ oil g scaffold posts title:string content:text author:string
$ oil g scaffold comments name:string email:string comment:text
$ oil g migration add_postid_to_comments postid:int
$ oil refine migrate
|
Then, browse http://your_blog_path/posts for posts and http://your_blog_path/comments for comments
And you could also see your fuel_dev database has the following structure:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| mysql> desc posts;
+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| title | varchar(255) | NO | | NULL | |
| content | text | NO | | NULL | |
| author | varchar(255) | NO | | NULL | |
| created_at | int(11) | NO | | NULL | |
| updated_at | int(11) | NO | | NULL | |
+------------+--------------+------+-----+---------+----------------+
6 rows in set (0.02 sec)
mysql> desc comments;
+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(255) | NO | | NULL | |
| email | varchar(255) | NO | | NULL | |
| comment | text | NO | | NULL | |
| created_at | int(11) | NO | | NULL | |
| updated_at | int(11) | NO | | NULL | |
| postid | int(11) | NO | | NULL | |
+------------+--------------+------+-----+---------+----------------+
7 rows in set (0.07 sec)
|
refer: http://thinklikearobot.com/2011/fuelphp/fuelphp-blog-tutorial-part-1/