GithubHelp home page GithubHelp logo

yvansuen / easy-organization Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jucloud/easy-organization

1.0 0.0 0.0 54 KB

这是我使用过最优雅的方式查询企业工商信息的SDK了

License: MIT License

PHP 100.00%

easy-organization's Introduction

前言

📦 一个 PHP 获取第三方(天眼查、企查查、启信宝)工商信息 SDK,公司业务需求问题,目前只实现了搜索和获取机构基本信息,其余接口未进行对接,大家如有需求可根据需求自行fork或者提交pr。

为了节约实现时间加快业务实现,总体架构借鉴了yansongda/pay,之前在做支付相关业务时,轮子造的很不错,比较简单容易理解,而且代码优雅,感谢yansongda作出的技术贡献。

欢迎 Star,欢迎 PR!

Latest Stable Version Latest Unstable Version Total Downloads License

特点

  • 多租户支持
  • Swoole 支持
  • 灵活的插件机制
  • 丰富的事件系统
  • 根据天眼查、企查查、启信宝最新 API 开发而成
  • 文件结构清晰易理解,可以随心所欲添加本项目中未支持的网关
  • 方法使用更优雅,不必再去研究那些奇怪的的方法名或者类名是做啥用的
  • 符合 PSR2、PSR3、PSR4、PSR7、PSR11、PSR14、PSR18 等各项标准,你可以各种方便的与你的框架集成

运行环境

  • PHP 7.4+
  • composer

支持的方法

天眼查

企查查

启信宝

安装

composer require jucloud/easy-organization

laravel 扩展包请 传送至这里

使用示例

基本使用(以天眼查为例):

<?php

namespace App\Http\Controllers;

use JuCloud\EasyOrganization\EasyOrganization;

class IndexController
{
    protected $config = [
        'tianyancha' => [
            'default' => [
                // 选填-默认为正常模式。可选为: MODE_NORMAL, MODE_SANDBOX, MODE_SERVICE
                'mode' => EasyOrganization::MODE_NORMAL,
                // 必填-天眼查分配的 token
                'token' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
            ],       
        ],   
        'logger' => [ // optional
            'enable' => false,
            'file' => storage_path('logs/jucloud.organization.log'),,
            'level' => 'info', // 建议生产环境等级调整为 info,开发环境为 debug
            'type' => 'single', // optional, 可选 daily.
            'max_file' => 30, // optional, 当 type 为 daily 时有效,默认 30 天
        ],
        'http' => [ // optional
            'timeout' => 5.0,
            'connect_timeout' => 5.0,
            // 更多配置项请参考 [Guzzle](https://guzzle-cn.readthedocs.io/zh_CN/latest/request-options.html)
        ],
    ];

    public function search()
    {   
        // keyword 关键词
        // page_size 每页大小
        // page_index 当前页数
        $result = EasyOrganization::tianyancha($this->config)->search([
            'keyword' => '',
            'page_size' => 0, //非必填
            'page_index' => 20, //非必填
        ]);

        return $result;
    }

}

代码贡献

由于测试及使用环境的限制,本项目中只开发了天眼查、企查查、启信宝的部分网关。 如果您有其它网关的需求,或者发现本项目中需要改进的代码,欢迎 Fork 并提交 PR!

LICENSE

MIT

easy-organization's People

Stargazers

孙逸飞 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.