ewci / cli-make-command

一个帮助创建命令类、控制器类、过滤器类、实体类、模型类的包

v1.0.1 2020-10-30 08:56 UTC

This package is auto-updated.

Last update: 2024-09-06 22:26:34 UTC


README

Latest Stable Version Total Downloads License

CodeIgniter CLI Make Command 基于 CodeIgniter 版本 4。当使用 CodeIgniter4 开发项目时,它将帮助您更快地生成模板文件(命令行、控制器、过滤器、实体、模型)。

这同样是从 Laravel 框架中得到的想法。

安装

先决条件

  1. CodeIgniter 框架 4.*
  2. Composer

Composer 安装

composer require ewci/cli-make-command

使用库

在 Mac/Linux 中打开终端或转到 Windows 的“运行”>“cmd”,导航到 CodeIgniter4 项目的根目录

php spark list

现在,如果您看到以下消息,则安装成功。

make
  make:command       Create a new command class.
  make:controller    Create a new controller class.
  make:entity        Create a new entity class.
  make:filter        Create a new filter class.
  make:model         Create a new model class.

指南

make:command

创建一个新的命令文件。

  • 使用

    php spark make:command [class_name] [options]
    
  • 描述

    Create a new command file.
    
  • 参数

    1. class_name : 命令名称。
  • 选项

    --command   The command name to run in spark. Defaults to command:name.
    --group     The group/namespace of the command. Defaults to CodeIgniter for basic commands, and Generators for generator commands.
    --type      The type of command, whether a basic command or a generator command. Defaults to basic
    -n          Set controller namespace
    --force     Set this flag to overwrite existing files on destination.
    

make:controller

创建一个新的控制器文件。

  • 使用

    php spark make:controller [class_name] [options]
    
  • 描述

    Create a new controller file.
    
  • 参数

    1. class_name : 控制器名称。
  • 选项

    --restful   Extends from a RESTful resource.
    -n          Set controller namespace
    --force     Set this flag to overwrite existing files on destination.
    

make:entity

创建一个新的实体文件。

  • 使用

    php spark make:entity [class_name] [options]
    
  • 描述

    Create a new entity file.
    
  • 参数

    1. class_name : 实体名称
  • 选项

    -n          Set entity namespace
    --force     Set this flag to overwrite existing files on destination.
    

make:model

创建一个新的模型文件。

  • 使用

    php spark make:model [class_name] [options]
    
  • 描述

    Create a new model file.
    
  • 参数

    1. class_name : 模型名称
  • 选项

    --dbgroup   Database group to use. Defaults to default.
    --entity    Set this flag to use an entity class as the return type.'
    --table     Supply a different table name. Defaults to the pluralized class name.'
    -n          Set model namespace
    --force     Set this flag to overwrite existing files on destination.
    

make:filter

创建一个新的过滤器文件。

  • 使用

    php spark make:filter [class_name] [options]
    
  • 描述

    Create a new filter file.
    
  • 参数

    1. class_name : 过滤器名称
  • 选项

    -n          Set filter namespace
    --force     Set this flag to overwrite existing files on destination.
    

享受!