克隆/下载
贡献代码
同步代码
谢宗 3.0 f1cc46a 5年前
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

安装

  • composer 私有库安装

composer.json 添加以下配置

"require": {
    "xapi/kernel": "*"
},
"config": {
    "secure-http": false
},
"repositories": [
    {
        "type": "composer",
        "url": "http://packages.shineiot.cn"
    }
],

修改 composer.json 文件之后,在终端运行 composer update 命令

composer update
  • 离线安装包安装

composer.json 添加以下配置

"require": {
    "xapi/kernel": "*"
},
"repositories": [
    {
        "type": "path",
        "url": "./xapi"
    }
],

修改 composer.json 文件之后,在终端运行 composer update 命令

composer update

快速上手

  • 新建 LoginController 控制器
<?php

namespace App\Http\Controllers\User;

use Xapi\Kernel\XapiController;
use App\Http\Requests\Login as LoginRequest;

class LoginController extends XapiController
{
    //public $middleware = []; //新增控制器中间件
    //public $except_middleware = []; //需要排除的中间件
    //public $method = 'index'; //路由对应的响应方法

    public function index(LoginRequest $request)
    {
        //处理登陆逻辑
    }
}
  • 访问路由,路由使用 any 请求方法,可以使用任何请求方法。
/xapi/user/login
  • 路由注册形式
xapi/{module}/{action}

创建配置文件

php artisan vendor:publish --provider="Xapi\Kernel\KernelServiceProvider"
路由配置项 route
  • 路由前缀 prefix

修改访问路由的前缀,默认:xapi

控制器配置项 controller
  • 控制器前缀 prefix

指定控制器命名空间的前缀,默认:App\Http\Controllers

  • middle

指定 moduleaction 中间可能存在的部分,默认:无,

  • 控制器后缀 suffix

指定控制器的后缀,默认:Controller

中间件配置项 middleware

指定所有 xapi 路由的中间件,默认包含 api 中间件,此项会覆盖默认设置,如需保留 api 中间件,请添加到数组中。

MIT License Copyright (c) 2020 谢宗 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
PHP
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化