# generator-thinkphp
> Yeoman generator for ThinkPHP - Create ThinkPHP Project and generate Controller/Model/View for it.
[中文文档](/README.md)
## Usage
Install `Composer` [Read more about composer](https://getcomposer.org/)
```
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
```
Install `yo` and `generator-thinkphp` [Read more about Yeoman](http://yeoman.io/)
```
npm install -g yo generator-thinkphp
```
Then `cd` into your workplace:
```
cd [workPlace]
```
**The `workPlace` means any folder that you would like to put your codes in.**
Run `yo thinkphp` to init your project, and follow the steps,you can name your app & install `Composer` and so on:
```
yo thinkphp
```
type `cd [appName]` get into your app and start coding:
```
cd [appName]
```
**`appName` is your custome app name**
## Generators
Available generators:
* [thinkphp](#Application) (aka [thinkphp:Application](#Application))
* [thinkphp:controller](#controller)
* [thinkphp:model](#model)
* [thinkphp:space](#space)
* [thinkphp:serve](#serve)
### App
Create a new project using [ThinkPHP](https://github.com/liu21st/thinkphp) and using [Composer](https://getcomposer.org/).
Example:
```bash
yo thinkphp
```
### Controller
Generates a controller and view for your Application. Command like `yo thinkphp:controller [classedName] [spaceName]`.
**The `classedName` is required value, without it will get error.**
**The default `spaceName` is `Home` and it's optional.**
Example:
```bash
yo thinkphp:controller Index Home
```
Produces `Application/Home/Controller/IndexController.class.php`:
```php
display();
}
}
```
Produces `Application/Home/View/Index/index.html`:
```html
Index