Manual:Tutorial/Hello World
From Kiwiphp
Notice: Kiwiphp is PHP5 only, please read the system requirement first.
Contents |
Get Kiwiphp Source
Donwload the source code from kiwiphp.googlecode.com. Place it in any directory (for example, C:\kiwiphp).
The directory structure looks as this:
C:\kiwiphp ├─example ├─runtime ├─tests └─tool
runtime is required, example, tests and tool are optional.
Run The Sample "Hello World"
Change directory to example\cli_entrance, run tool.php with your php command line interpreter (for example: C:\php\php.exe):
C:\php\php.exe C:\kiwiphp\example\cli_entrance\tool.php --module hello --action HelloWorld
Then you will see "Hello World!" printed on command line window.
Create Your First Project
Project Directory Structure
Open your web server's document root (for example, C:\apache\htdocs), create directories like this:
C:\apache\htdocs\1st_kiwi_proj ├─app │ └─frontend │ └─module │ └─hello │ └─action └─entry └─web └─frontend.php
Bootstrap File
Open C:\apache\htdocs\1st_kiwi_proj\entrance\web\frontend.php, add:
<?php include('C:/kiwiphp/runtime/kiwi.php'); Kiwi::run();
First Action
Open C:\apache\htdocs\1st_kiwi_proj\app\frontend\module\hello\HelloWorldAction.php, add:
<?php class HelloWorldAction extends Action { public function execute() { echo "Hello World!"; } }
Run
Run As Web Application
Launch your browser, point to http://localhost/1st_kiwi_proj/web/frontend.php?module=hello&action=HelloWorld
You will see a page with "Hello World!" displayed.
Run on CLI
Open your command line window, execute:
C:\php\php.exe C:\apache\htdocs\1st_kiwi_proj\entrance\web\frontend.php -m hello -a HelloWorld
Your will see a "Hello World" printed on the command line window.
Congratulations! Your first kiwiphp project run succeed!

