Download the PHP package idopin/api-support without Composer

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

Apisupport

一、安装

功能:

二、配置

2.1 异常处理

在文件 app\Exceptions\Handler.php 中添加以下方法:

2.2 创建迁移

运行命令后,将会生成7个表:

  1. oauth_access_tokens

  2. oauth_auth_codes

  3. oauth_clients

  4. oauth_personal_access_clients

  5. oauth_refresh_tokens

  6. files

  7. user_files

2.3 执行 Aritsan 命令

运行此命令后,生成:

2.4. 添加 Trait

添加 Laravel\PassportHasApiTokens trait 到 App\Models\User 模型中,此 trait 提供一些帮助方法用于检查已认证用户的令牌和权限范围。

2.5 配置文件

在配置文件config/auth.php 中,将 api 的授权看守器 guards 的 driver 设置为 passport。

2.6 .自定义用户名字段

当使用密码授权方式验证时,Passport 默认使用你的授权模型的 email 属性作为 “用户名”。当然,你也可以通过在你的模型中定义 findForPassport 方法来定义验证行为:

2.7 自定义密码验证

当使用密码授权方式时,Passpot 默认使用模型的 password 属性验证密码。如果你的模型没有 password 属性,或者你想自定义密码验证逻辑,你可以在你的模型中自定义方法 validateForPassportPasswordGrant:

2.8 添加环境变量

三、使用

3.1 返回状态码

对应的枚举类型

Idopin\ApiSupport\Enums\ApiCode

3.2 响应 Trait

ApiResponseTrait , 它主要提供了 response 方法 和 responseEqual 方法。

Idopin\ApiSupport\Traits\ApiResponseTrait

3.3 控制器基类

Idopin\ApiSupport\Controller

控制器基类引用了 响应 Trait,可直接通过 $this->response(...) 调用。

3.4 辅助函数

3.5 表单验证基类

Idopin\ApiSupport\Requests\FormRequest

表单验证基类引用了 响应 Trait,可直接通过 $this->response(...) 调用。

3.6 资源基类

Idopin\ApiSupport\Resources\JsonResource

响应内容包裹了在 result 里。

并带有以下三个字段:

3.7 异常 Trait

Idopin\ApiSupport\Traits\trait ApiExceptionTrait

3.8 验证码中间件

3.9 路由

3.9.1 用户认证
URL 方法 数据 路由名称
authorizations POST username: string; password:string authorizations.store
authorizations/id GET - authorizations.id
authorizations DELETE - authorizations.delete
3.9.2 文件上传
URL 方法 数据 路由名称 功能
/files/{file} GET file:文件ID 根据文件 ID 显示文件
/files POST file:File;public:0/1 上传文件
/files/check POST md5:String 根据文件ID判断文件是否存在
3.9.3 图片与短信验证码
URL 方法 数据 路由名称 功能
/api/captchas POST 发送图片验证码
/api/sms POST phone:string 电话号码 发送短信验证码

All versions of api-support with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
laravel/framework Version ^9.2
laravel/passport Version ^10.4
gregwar/captcha Version ^1.1
overtrue/easy-sms Version ^2.1
propaganistas/laravel-phone Version ^4.3
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 idopin/api-support contains the following files

Loading the files please wait ....