Download the PHP package hxc/curd without Composer

On this page you can find all versions of the php package hxc/curd. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package curd

代码生成工具

代码生成工具主要用于生成后端开发中简单的增删改查代码,复杂的逻辑还需自己实现,不过你无须担心,我们通过简单的封装简化了开发流程,即便你是新手,也可以写出出色的代码。

工具基于ThinkPHP 5.0开发。

安装

生成工具的开启

项目根目录下运行 php think hxc命令即可;根目录下生成的hxc.lock不可删除。

框架说明

框架核心功能为代码生成;主要分为两个大的模块,即前台,后台;目前数据库的操作均为ThinkPHP 5.0中的模型方式。

关于性能

为了优化查询性能,默认全部的数据库查询走缓存方式,当然,你也可以在控制器中自己选择是否开启;对此也解决了在执行数据库的增,改,删操作的时候,缓存也会即时刷新,前提是你必须使用model的方式。

如何使用

操作之前请先完善数据表,以下全部操作都是基于数据表的字段。

名词解释

开启生成工具

在项目根目录执行以下命令:

执行完毕后访问项目域名/generate即可。

配置文件

开启生成工具时会在APP_PATH/extra/curd.php生成配置文件,详情查看文件中的注释。如果此文件存在则不会覆盖,请自行检查内容是否完整。

选项说明

此章节针对生成工具界面上的选项进行简单说明

生成内容

数据库相关操作均使用ThinkPHP 5.0的模型操作,具体参考ThinkPHP 5.0文档

后台

protected $modelName  = '模型名'; 
protected $indexField = ['列表页要显示字段']; 在日常开发中,我们需要在列表中追加表格的列,首先我们需要在这里进行编辑
protected $addField = ['新增页面的表单输入字段'];
protected $editField = ['编辑页面的表单输入字段'];
/**
 * 条件查询,字段名,例如:无关联查询['name','age'],关联查询['name','age',['productId' => 'product.name']],解释:参数名为productId,关联表字段p.name
 * 默认的类型为输入框,如果有下拉框,时间选择等需求可以这样定义['name',['type' => ['type','select']]];目前有select,time_start,time_end三种可被定义
 * 通过模型定义的关联查询,可以这样定义['name',['memberId'=>['member.nickname','relation']]],只能有一个被定义为relation,且字段前的表别名必须为关联的方法名
 * @var array
 */
protected $searchField = [];
protected $pageSize = 10;                 //当前页面显示的数据数量,用于分页
//添加数据验证规则,参考tp5的验证规则
protected $add_rule = [
    'nickName|昵称'  => 'require|max:25'
];
//编辑数据验证规则,参考tp5的验证规则
protected $edit_rule = [
    'nickName|昵称'  => 'require|max:25'
];

前台

模型

当前版本生成的模型,全部位于\app\common\model,前后台使用统一的模型类。具体属性含义,请参考模型内注释和ThinkPHP 5.0文档。

前台接口

默认提供四个接口,路径一致,通过请求方式和参数进行区分,不影响自定义的方法,详见下方表格:

地址 请求方式 响应方法 备注
/app/控制器/index get get 查询。传入id时返回详情,字段按照$detailField定义的返回;
否则返回列表,字段按照$indexField定义的返回。
/app/控制器/index post post 新增
/app/控制器/index put put 修改
/app/控制器/index delete delete 删除

数据返回

目前工具封装了统一的返回方法,位于\Hxc\Curd\Traits\JsonReturn,提供了以下方法

项目上线

参考文档


All versions of curd with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hxc/curd contains the following files

Loading the files please wait ....