Download the PHP package trappistes/api-sign without Composer

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

API 签名校验

介绍

Laravel/Lumen API 签名校验包

安装教程

Laravel

首选安装包

发布资源(非必须),仅在需要调整表数据结构时使用

执行迁移

注册路由中间件,在 app/Http/Kernel.php 中添加

Lumen

首选安装包

需要手动注册服务,在 bootstrap/app.php 中添加

发布资源(非必须),仅在需要调整表数据结构时使用

执行迁移

注册路由中间件, 在 bootstrap/app.php 中添加

使用

请求参数

参数名 类型 是否必须 描述
Signature-Access-Key string 应用Key
Signature-Method string 签名类型,默认:md5(支持md5,hmacsha256)
Signature-Nonce string 一次性验证随机字符串,长度1-32位任意字符(建议使用时间戳+随机字符串)
Signature-Timestamp string 签名时间戳,有效期600s($ttl参数控制)
Signature-String string 签名字符串,参考签名规则

业务参数

如果API本身有业务级的参数也必须传入。如:http://endpoint.com/api/users?group_id=1&active=1&foo=bar... group_id=1 active=1 foo=bar 等query_param需要进行签名。

签名方法

  1. 对除sign参数外的所有API请求参数(包括公共参数access_key,method,nonce,timestamp,(不含sign-string)和业务请求参数),根据参数名称的ASCII码表的顺序排序。 如:foo=1, bar=2, foo_bar=3, foobar=4 排序后的顺序是 bar=2, foo=1, foo_bar=3, foobar=4;
  2. 将排序好的参数名和参数值拼装在一起,根据上面的示例得到的结果为:bar2foo1foo_bar3foobar4;
  3. 把拼装好的字符串采用utf-8编码,使用签名算法对编码后的字符串进行摘要; 如:md5(bar2foo1foo_bar3foobar4 + secret) ,hash_hmac('sha256', bar2foo1foo_bar3foobar4 + secret, secret);
  4. 将摘要得到的字节结果使用大写表示。如:strtoupper($sign_string);

后端校验方法

在需要校验的路由上使用中间件校验

Laravel

Lumen

key & secret 管理(略)CURD自行实现

Trappistes\ApiSign\Models\AccessKey;


All versions of api-sign with dependencies

PHP Build Version
Package Version
No informations.
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 trappistes/api-sign contains the following files

Loading the files please wait ....