FuelPHP FrameWork 初體驗~~

FuelPHP is a simple, flexible, community driven PHP 5.3 web framework based on the best ideas of other frameworks with a fresh start.
FuelPHP 衝著他以php 5.3 並以namespace 方式開發,輕量化FrameWork趕快來試用看看吧.

安裝

安裝方式不免俗來了,快速按裝.(不錯唷)

1
2
3
4
5
6
7
$ curl get.fuelphp.com/oil | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   244  100   244    0     0    240      0  0:00:01  0:00:01 --:--:--  1257
Password:
 
$


咦捨摸錯誤都沒有噴就是裝好了.
找了一下他裝了啥鬼

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ cat /usr/bin/oil
#!/bin/bash
 
if [ -f "./oil" ]; then
        php oil "$@"
else
 
        if [ "$1" == "create" ]; then
 
                    if [ ! `which git` ]; then
                         echo "For this installer to work you'll need to install Git."
                     echo '        http://git-scm.com/'
                    fi
 
                git clone --recursive git://github.com/fuel/fuel.git "./$2"
                php "./$2/oil" refine install
        else
                echo 'This is not a valid Fuel installation so Oil is a bit lost.'
                echo '        http://fuelphp.com/docs/installation/instructions.html'
 
        fi
fi

原來是再下 create 指令時馬上用git拉下來建立好專案.(不錯
例:

1
$ oil create <project_name]]>

來建一個試試

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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
$ oil create Fuel
Cloning into ./Fuel…
remote: Counting objects: 14163, done.
remote: Compressing objects: 100% (4884/4884), done.
remote: Total 14163 (delta 9660), reused 13351 (delta 9047)
Receiving objects: 100% (14163/14163), 2.07 MiB | 651 KiB/s, done.
Resolving deltas: 100% (9660/9660), done.
Submodule 'docs' (git://github.com/fuel/docs.git) registered for path 'docs'
Submodule 'fuel/core' (git://github.com/fuel/core.git) registered for path 'fuel/core'
Submodule 'fuel/packages/auth' (git://github.com/fuel/auth.git) registered for path 'fuel/packages/auth'
Submodule 'fuel/packages/email' (git://github.com/fuel/email.git) registered for path 'fuel/packages/email'
Submodule 'fuel/packages/oil' (git://github.com/fuel/oil.git) registered for path 'fuel/packages/oil'
Submodule 'fuel/packages/orm' (git://github.com/fuel/orm.git) registered for path 'fuel/packages/orm'
Submodule 'fuel/packages/parser' (git://github.com/fuel/parser.git) registered for path 'fuel/packages/parser'
Cloning into docs...
remote: Counting objects: 5478, done.
remote: Compressing objects: 100% (1908/1908), done.
remote: Total 5478 (delta 3664), reused 5251 (delta 3470)
Receiving objects: 100% (5478/5478), 1.70 MiB | 757 KiB/s, done.
Resolving deltas: 100% (3664/3664), done.
Submodule path 'docs': checked out 'f3746d4fcda2dc12d7f1120d55c17f3b52c0550e'
Cloning into fuel/core...
remote: Counting objects: 20779, done.
remote: Compressing objects: 100% (6318/6318), done.
remote: Total 20779 (delta 14499), reused 20306 (delta 14065)
Receiving objects: 100% (20779/20779), 3.21 MiB | 1.08 MiB/s, done.
Resolving deltas: 100% (14499/14499), done.
Submodule path 'fuel/core': checked out 'd95fbfec3fe2f791fead4eeb9a37fcd631009479'
Cloning into fuel/packages/auth...
remote: Counting objects: 541, done.
remote: Compressing objects: 100% (384/384), done.
remote: Total 541 (delta 240), reused 453 (delta 157)
Receiving objects: 100% (541/541), 67.77 KiB, done.
Resolving deltas: 100% (240/240), done.
Submodule path 'fuel/packages/auth': checked out '7a2c479263f768b6de8bffe43b1bd00fd2bbdd6d'
Cloning into fuel/packages/email...
remote: Counting objects: 273, done.
remote: Compressing objects: 100% (157/157), done.
remote: Total 273 (delta 114), reused 268 (delta 109)
Receiving objects: 100% (273/273), 42.33 KiB, done.
Resolving deltas: 100% (114/114), done.
Submodule path 'fuel/packages/email': checked out '0113f3c6596e5b3b97408607ddc033e3a7dc833a'
Cloning into fuel/packages/oil...
remote: Counting objects: 869, done.
remote: Compressing objects: 100% (370/370), done.
remote: Total 869 (delta 491), reused 837 (delta 467)
Receiving objects: 100% (869/869), 114.39 KiB | 79 KiB/s, done.
Resolving deltas: 100% (491/491), done.
Submodule path 'fuel/packages/oil': checked out 'da74ddc023871ef54a93fdcc541cbf2db95b73f3'
Cloning into fuel/packages/orm...
remote: Counting objects: 14393, done.
remote: Compressing objects: 100% (4295/4295), done.
remote: Total 14393 (delta 9963), reused 14302 (delta 9877)
Receiving objects: 100% (14393/14393), 2.07 MiB | 863 KiB/s, done.
Resolving deltas: 100% (9963/9963), done.
Submodule path 'fuel/packages/orm': checked out 'ad18b80efcc712e02143a14d6e0902aab25da475'
Cloning into fuel/packages/parser...
remote: Counting objects: 603, done.
remote: Compressing objects: 100% (303/303), done.
remote: Total 603 (delta 285), reused 571 (delta 254)
Receiving objects: 100% (603/603), 113.31 KiB | 77 KiB/s, done.
Resolving deltas: 100% (285/285), done.
Submodule path 'fuel/packages/parser': checked out '836c1ad77e631d47839630f3fa79b9dddc0b8091'
     Made writable: /Users/luosteve/Fuel/fuel/app/cache
     Made writable: /Users/luosteve/Fuel/fuel/app/logs
     Made writable: /Users/luosteve/Fuel/fuel/app/tmp
     Made writable: /Users/luosteve/Fuel/fuel/app/config

來看一下裝好啥.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ cd Fuel
$ php oil
 
Usage:
  php oil [cells|console|generate|refine|help|test]
 
Runtime options:
  -f, [--force]    # Overwrite files that already exist
  -s, [--skip]     # Skip files that already exist
  -q, [--quiet]    # Supress status output
  -t, [--speak]    # Speak errors in a robot voice
 
Description:
  The 'oil' command can be used in several ways to facilitate quick development, help with
  testing your application and for running Tasks.
 
Documentation:
  http://docs.fuelphp.com/packages/oil/intro.html

管他的先上再說!!

來設定一下nginx設定檔

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
server {
    listen 127.0.0.1:80;
    server_name fuel;
    access_log /Users/luosteve/Fuel/fuel/app/logs/fuel.access.log;
    error_log  /Users/luosteve/Fuel/fuel/app/logs/fuel.error.log;
    root /Users/luosteve/Fuel/public;
 
    location / {
        root   /Users/luosteve/Fuel/public;
        index  index.php index.html index.htm;
        if (!-e $request_filename) {
            rewrite ^.*$ /index.php last;
            break;
        }
    }
    location ~ \.php$ {
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_index  index.php;
      fastcgi_param  SCRIPT_FILENAME  /Users/luosteve/Fuel/public$fastcgi_script_name;
      include        fastcgi_params;
    }
    location ~ /\.ht {
            deny  all;
    }
}

好了重起nginx 並瀏覽 http://fuel/
!!!登登 出現啦

畫面也有說明 此controller 是 APPPATH/classes/controller/welcome.php
view 再 APPPATH/views/welcome/index.php
APPPATH此範例是存在/Users/luosteve/Fuel/fuel/app/
再這裡要說明一下,作者將APP 整個包在FrameWork內實在是很頭痛作法.當你自行開發更改專案時,
如果此時有FrameWork有更新 你只能以rebase 方式做更新,好死不死哪天又有衝突你每次更新就在那
解衝突(整個就飽了,不用做事了).
其實一開始看到此架構就先倒退三尺XDD.

有興趣可以先看看config設定吧(咦?!是php 檔案唷)
fuel/app/config/config.php
內文就不看啦,各種設定值請參考.
就醬而已sorry.

One thought on “FuelPHP FrameWork 初體驗~~

  1. Pingback: FuelPHP FrameWork 進入! Enter~~ « SDpower

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *