All Projects → greedying → Zhima

greedying / Zhima

Licence: mit
芝麻信用商家服务PHP版SDK。目前为止,是github上最好用的php版SDK

Projects that are alternatives of or similar to Zhima

Telegram Bot Sdk
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
Stars: ✭ 2,212 (+16915.38%)
Mutual labels:  sdk, composer
Mailchimp Api 3.0 Php
A feature rich object-oriented PHP library for interacting with MailChimp's API v3 💌🐵
Stars: ✭ 61 (+369.23%)
Mutual labels:  sdk, composer
Openapi Sdk Php Client
Official repository of the Alibaba Cloud Client for PHP
Stars: ✭ 206 (+1484.62%)
Mutual labels:  sdk, composer
Linkedin Api Php Client
LinkedIn API PHP SDK with OAuth 2 support. Can be used for social sign in or sharing on LinkedIn. Has a good usage examples
Stars: ✭ 88 (+576.92%)
Mutual labels:  sdk, composer
Openapi Sdk Php
Alibaba Cloud SDK for PHP
Stars: ✭ 423 (+3153.85%)
Mutual labels:  sdk, composer
Tiny Composer Installer
Small, auditable Composer installer, well suited for automated environments.
Stars: ✭ 9 (-30.77%)
Mutual labels:  composer
Smartystreets Go Sdk
The official client libraries for accessing SmartyStreets APIs from Go.
Stars: ✭ 11 (-15.38%)
Mutual labels:  sdk
Kudo
Kubernetes Universal Declarative Operator (KUDO)
Stars: ✭ 849 (+6430.77%)
Mutual labels:  sdk
Aliyun Openapi Python Sdk
Alibaba Cloud SDK for Python
Stars: ✭ 840 (+6361.54%)
Mutual labels:  sdk
Xhgui Branch
uprofiler UI,xhprof UI,tideways UI , PHP Non-intrusive performance monitoring platform.
Stars: ✭ 872 (+6607.69%)
Mutual labels:  composer
Php Yandex Alisa
PHP Yandex SDK для создания навыков Алисы.
Stars: ✭ 12 (-7.69%)
Mutual labels:  sdk
Phpqa
Docker image that provides static analysis tools for PHP
Stars: ✭ 853 (+6461.54%)
Mutual labels:  composer
Node Sdk
An SDK implementation in JS (Node) for the v3 REST APIs.
Stars: ✭ 9 (-30.77%)
Mutual labels:  sdk
Appkefu android demo v4
微客服 安卓客服demo 4.x 版本 (IM, SDK, ChatUI, helpdesk, 客服系统 )
Stars: ✭ 11 (-15.38%)
Mutual labels:  sdk
Weixinmpsdk
微信全平台 SDK Senparc.Weixin for C#,支持 .NET Framework 及 .NET Core、.NET 6.0。已支持微信公众号、小程序、小游戏、企业号、企业微信、开放平台、微信支付、JSSDK、微信周边等全平台。 WeChat SDK for C#.
Stars: ✭ 7,098 (+54500%)
Mutual labels:  sdk
Entwechat
📦 WeChat Enterprise SDK based on EasyWeChat 3.X
Stars: ✭ 12 (-7.69%)
Mutual labels:  sdk
Newbe.mahua.framework
本SDK为实现QQ机器人平台的大一统,支持多种机器人平台:酷Q、MyPCQQ、QQLight等
Stars: ✭ 849 (+6430.77%)
Mutual labels:  sdk
Vst3sdk
VST 3 Plug-In SDK
Stars: ✭ 853 (+6461.54%)
Mutual labels:  sdk
Heroku Wp
WordPress on Heroku
Stars: ✭ 865 (+6553.85%)
Mutual labels:  composer
Accompli
An easy to use and extendable deployment tool for (PHP) projects.
Stars: ✭ 9 (-30.77%)
Mutual labels:  composer

芝麻信用PHP SDK

Requirement

  1. PHP >= 5.5.9
  2. composer
  3. openssl 拓展

SDK 对所使用的框架并无特别要求

Installation

可以使用composer引用

"require": {
	"greedying/zhima" : "dev-master"
},

Usage

基本使用示例:

  1. 配置与初始化
<?php
use Greedying\Zhima\Foundation\Application;

$options = [
	'app_id'    => '123456',
	'scene'     => 'yourscene',
	'private_key_file' => "/dir/to/your/rsa_private_key.pem",
	'zhima_public_key_file' => "/dir/to/your/zhima_public_key.pem",
];

$zhima = new Application($options);

$open_id = '123456';
transaction_id = '234567';

?>

1.授权

<?php

$auth = $zhima->auth;
$auth->identity_type = '2';
$auth->identity_param = json_encode([
	'certNo'    => '身份证号',
	'certType'  => 'IDENTITY_CARD',
	'name'      => '名字',
]);

$auth->state = 'your state string'; //自定义字符串

$url = $auth->getH5Url();//H5授权链接
//$url = $auth->getPcUrl();//Pc授权链接

//其他暂时没有实现

$this->redirect($url); //访问授权链接,进入芝麻页面

//回调页面,传入callback函数即可,notify为已经解密的数据, successful为是否授权成功
$auth->handleNotify(callback function ($notify, $successful) {
		//your code
});

//查询是否授权
$auth->identity_type = '2';
$auth->identity_param = json_encode([
	'certNo'    => '身份证号',
	'certType'  => 'IDENTITY_CARD',
	'name'      => '名字',
]);

$auth->state = 'your state string'; //自定义字符串
$result = $auth->query(); //true or false
?>

2.查询芝麻分

<?php

//只查询分数
$score = $zhima->score->score($open_id, $transaction_id); 

//查询分数信息
$score = $zhima->score->query($open_id, $transaction_id); 

?>

3.查询行业关注名单

<?php

$score = $zhima->watchlist->query($open_id, $transaction_id); 


?>

4.查询反欺诈信息

<?php
$info = [
	'transaction_id'    => '',
	'open_id'           => '',
	'cert_no'           => '',
	'cert_type'         => '100',
	'name'              => '',
	'mobile'            => '',
	'email'             => '',
	'bank_card'         => '',
	'address'           => '',
	'ip'                => '',
	'mac'               => '',
	'wifimac'           => '',
	'imei'              => '',
	'imsi'              => '',
];


//只查询得分
$score = $zhima->ivs->score($open_id, $transaction_id); 

//查询相信信息
$score = $zhima->isv->query($open_id, $transaction_id); 


?>

说明

  1. 时间问题,只实现了部分我能用到的接口,其他接口如需要,欢迎pr.
  2. 仍然是时间问题,目前没有实现日志、异常处理、测试代码,同样欢迎pr.
  3. 使用本SDK前,你应该尽量看懂芝麻的技术文档,本文不是一个从零开始的教程
  4. 恩,也别太信芝麻的文档;里面的错误比芝麻还密集...

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].