diff --git a/README.md b/README.md index 950a628..414054c 100644 --- a/README.md +++ b/README.md @@ -1 +1,344 @@ -# CodeIgniter4_CLI-Create \ No newline at end of file +# CodeIgniter4_CLI-Create + +Cli-Create is based on CodeIgniter4. It will help you generate template files more quickly when developing projects with CodeIgniter4. + +[Guide](https://hackmd.io/@monkenWu/HJndHeESU) + +## Install + +### Prerequisites +1. CodeIgniter Framework 4.* +2. Composer + +### Composer Install + +``` +composer require monken/cli-create +``` +### Use Library + +Open Terminal in Mac/Linux or go to Run > “cmd” in Windows and navigate to CodeIgniter4 project’s root: + +``` +php spark list +``` + +Now, if you see the following message, the installation is successful. + +``` +CodeIgniter CLI Tool - Version 4.0.2 - Server-Time: 2020-03-09 12:04:21pm + + +Cli-Create + create:controller Create a new controller file. + create:model Create a new model file. +``` + +# Guide + +## create:controller + +Create a new controller file. + +* Use + ``` + $ php spark create:controller [controller_name] [Options] + ``` + +* Description: + ``` + Create a new controller file. + ``` +* Arguments: + 1. controller_name : The controller name. + +* Options: + ``` + -nobase Do not extends BaseControllers Class. + -usemodel Choose models. + -space Create folders and files according to the path you typed. + ``` + +### Create a normal Controller + +You can use : + +``` +$ php spark create:contorller [controller_name] +``` + +Now, in "app/Controllers" You can see the new Contorller File like this : + +```php + The namespace in Codeigniter usually maps the actual file storage path, so using this command will automatically create folders according to the value you entered. + +Now, in “app/Controllers/System/Admin” You can see the new "-nobase" Controller File like this : + +```php +db =& $db; + } +} +``` + +### Create a entity model + +CodeIgniter supports Entity classes as a first-class citizen in it’s database layer, while keeping them completely optional to use. They are commonly used as part of the Repository pattern, but can be used directly with the Model if that fits your needs better. + +You can use this command : + +``` +$ php spark create:model [model_name] [entity_name] -entity +``` +Now, in “app/Models” You can see the new Manual Model File like this : + +```php + The namespace in Codeigniter usually maps the actual file storage path, so using this command will automatically create folders according to the value you entered. + +Now, in “app/Models/Api/System” You can see the new Manual Model File like this : + +```php +