hyperfx/feishu

v4.2.0 2023-06-12 12:33 UTC

This package is auto-updated.

Last update: 2024-11-12 15:38:11 UTC


README

PHPUnit

composer require limingxinleo/feishu

使用

具体使用方法请查看 飞书文档

快速开始

Hyperf 框架中,可以直接使用 Fan\Feishu\Factory

  1. 发布配置
php bin/hyperf.php vendor:publish limingxinleo/feishu
  1. 注入并使用
<?php

use Fan\Feishu\Factory;
use Hyperf\Di\Annotation\Inject;

class IndexController
{
    #[Inject]
    public Factory $factory;
    
    public function index()
    {
        return $this->factory->get('default')->contact->batchGetUserId(emails: ['l@hyperf.io']);
    }
}

其他框架,可以自行 new Application() 使用。

<?php

use Fan\Feishu\Application;

$app = new Application([
    'app_id' => 'xxx',
    'app_secret' => 'xxx',
    'http' => [
        'base_uri' => 'https://open.feishu.cn',
        'http_errors' => false,
        'timeout' => 2,
    ],
]);

$result = $app->contact->batchGetUserId(emails: ['l@hyperf.io']);