Download the PHP package lswl/laravel-api without Composer

On this page you can find all versions of the php package lswl/laravel-api. 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 laravel-api

目录

安装配置

使用以下命令安装:

发布文件[可选]:

使用说明

环境变量值参考:env

restful参考: restful

快速使用

  1. 安装
  2. 发布配置[可选]
  3. 注册中间件
  4. 继承异常处理程序
  5. 使用路由服务提供者
  6. 示例代码

中间件

异常处理

使用路由服务提供者

示例代码

控制器

模型

服务层

数据访问层

控制器

需继承 Lswl\Api\Controllers\BaseController

模型

普通模型

需继承 Lswl\Api\Models\BaseModel

中间表模型

需继承 Lswl\Api\Models\BasePivot

服务层

需继承 Lswl\Api\Services\BaseService

数据访问层

需继承 Lswl\Api\Daos\BaseDao

中间件

用法加粗为必须调用

中间件 别名 用法 需要实现的契约或继承模型
Lswl\Api\Middleware\ParamsHandlerMiddleware lswl.params.handler 参数处理 ---
Lswl\Api\Middleware\ConvertEmptyStringsToNullMiddleware lswl.convert.empty.strings.to.null 转换空字符串为null ---
Lswl\Api\Middleware\TrimStringsMiddleware lswl.trim.strings 清除字符串空格 ---
Lswl\Api\Middleware\RequestLockMiddleware lswl.request.lock 请求锁定 ---
Lswl\Api\Middleware\RequestLogMiddleware lswl.request.log 记录请求日志(debug) ---
Lswl\Api\Middleware\CheckVersionMiddleware lswl.check.version 检测应用版本 Lswl\Api\Contracts\VersionModelInterface
Lswl\Api\Models\VersionModel
Lswl\Api\Middleware\CheckSignatureMiddleware lswl.check.signature 验证请求签名 ---
Lswl\Api\Middleware\CheckTokenMiddleware lswl.check.token 检测token,设置用户数据 Lswl\Api\Contracts\UserModelInterface
Lswl\Api\Models\UserModel
Lswl\Api\Middleware\CheckSdlMiddleware lswl.check.sdl 单设备登录,需要复写 Lswl\Api\Handlers\ExceptionHandler->sdlHandler() ---

异常处理

App\Exceptions\Handler 继承 Lswl\Api\Handlers\ExceptionHandler

其他异常捕获调用父类 response() 方法并重写,参考 Lswl\Api\Handlers\ExceptionHandler->response()

服务提供者

API服务提供者

Lswl\Api\Providers\LswlApiServiceProvider

契约服务提供者

Lswl\Api\Providers\LswlContractServiceProvider

路由服务提供者

Lswl\Api\Providers\LswlRouteServiceProvider

默认不启用

trait介绍

RequestInfoTrait.php

Lswl\Api\Traits\RequestInfoTrait

请求信息绑定

使用类:

ResourceControllerTrait.php

Lswl\Api\Traits\ResourceControllerTrait

资源控制器 trait

ResourceServiceTrait.php

Lswl\Api\Traits\ResourceServiceTrait

资源服务 trait

ResultThrowTrait.php

Lswl\Api\Traits\ResultThrowTrait

异常抛出辅助

UserInfoTrait.php

Lswl\Api\Traits\UserInfoTrait

用户信息绑定

使用类:

工具类介绍

Agent.php

Lswl\Api\Utils\Agent

请求 Agent 类

SdlCache.php

Lswl\Api\Utils\SdlCache

单设备登录类

Token.php

Lswl\Api\Utils\Token

令牌相关类


All versions of laravel-api with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
ext-mbstring Version *
ext-json Version *
ext-openssl Version *
lswl/sign Version ^1.0
lswl/laravel-support Version ^8.0
lswl/laravel-log Version ^8.0
lswl/laravel-database Version ^8.0
jenssegers/agent Version ^2.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 lswl/laravel-api contains the following files

Loading the files please wait ....