Changes
Title
changed
Use phing to make ourYii application "installable"
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
phing
Content
changed
To use this "how-to", you need to install
[phing
in your machine. [Phing](PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant. "Phing")](http://www.phing.info/trac/ "phing") in your machine.
I want to show you a little example that allow
s me to configure gii password and database informations, with phing.
First of all, when I start a new yii application, I copy protected/config/main.php in protected/config/main.php.dist
, and updating some field like
...:
```php
'db' => array(
'emulatePrepare' => true,
'charset' => 'utf8',
'connectionString' => 'mysql:host=[[hostname]];dbname=[[database]]',
'emulatePrepare' => true,
'username' => '[[username]]',
'password' => '[[password]]',
'charset' => 'utf8',
),
```
Also, I like
alsto set gii configuration in this way:
```php
'gii' => array(
'class' => 'system.gii.GiiModule',
'password' => '[[giipassword]]',
'ipFilters' => array('127.0.0.1', '::1'),
),
```
Now, myMy complete config(.dist) file looks like this:[...]
```
Now I can create build.xml and put it inside this content:
~~~[...]
And now, I can run
~~~
$ phing
~~~
The output will be similar to this:[...]
```
As you can see, some questions will be asket tod from you. Your answers will
be override main.php.dist file
options when copying it
into main.php.
And
This is just a simple example of how you can install your application
usin
g this
easy way. This is just a simple examplemethod.
You can also, for example, create your own console command and call them with phing.