Download the PHP package zhuitech/boot-laravel without Composer
On this page you can find all versions of the php package zhuitech/boot-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package boot-laravel
Boot Laravel
Laravel 开发加速包
- 常用包的自动化配置
- 微服务快速开发框架
框架要求
Laravel >= 5.5
安装
为了灵活和速度,不直接依赖第三方包,在需要使用对应功能的时候,请添加第三方包。会自动配置已经安装的第三方包。
配置
我们使用一个Provider来包含大部分的配置,这样比直接修改config目录要容易管理。
常用命令
一些常用的命令,方便在编码的时候快速参考。
资源服务
模块提供了Restful基础增强类,可以快速开发出标准的Restful服务接口。
1. 创建模型
2. 生成数据库
3. 创建仓库类
4. 创建控制器
5. 创建路由
子资源服务
继承SubRestController就可以实现 parents/{id}/child/{id} 类似的子资源服务,下面提供一个消息发送记录的示例,主要是Controller和routes的写法有一些区别。
Controller
routes/api.php
微服务相互调用
模块提供了微服务调用的实用方法,在调用前需要先把微服务地址配置到.env文件。
微服务调用代码
微服务用户身份
微服务的授权在api网关实现,网关会把用户身份信息附带在http请求中传递给微服务。 MicroServiceProvider会自动配置授权机制,内建了后台(admins)和前台(members)两种授权方式。
最佳实践建议微服务中不要使用强制授权,在代码中判断用户是否存在。
如要对微服务单独测试,请在Postman中设置一下Headers。
微服务示例
下面用Channels服务做列子。
1. 查询接口 [GET /api/mail/channels]
- 返回所有记录:/api/mail/channels?limit=-1&_order[id]=desc
- 返回部分记录:/api/mail/channels?limit=10
- 返回分页记录:/api/mail/channels?_page=1&_size=10
- 返回部分字段:/api/mail/channels?_column=id,name
- 返回符合条件的记录:- /api/mail/channels?type=smtp&name[like]=test&username[null]=1&id[>]=10
2. 创建接口 [POST /api/mail/channels]
3. 更新接口 [PUT /api/mail/channels/{id}]
4. 删除接口 [DELETE /api/mail/channels/{id}]
5. 子资源查询接口 [GET /api/mail/messages/{id}/sendings]
6. 子资源删除接口 [DELETE /api/mail/messages/{id}/sendings/{id}]
自定义配置
自定义配置功能用来在数据库存储一些个性化配置数据。 该功能依赖system服务,请在env文件配置 SERVICE_SYSTEM=https://system.test.z-cloud.vip
All versions of boot-laravel with dependencies
bkwld/croppa Version ^4.9
league/fractal Version ^0.17.0
overtrue/laravel-lang Version ~3.0