kryptonpay / powerbi-sdk
PowerBI 的 PHP SDK,用于与 PowerBI 交互
dev-master
2022-02-03 21:49 UTC
Requires
- php: >=5.6
- guzzlehttp/guzzle: ^7.3
Requires (Dev)
- codacy/coverage: ^1.1
- mockery/mockery: ^0.9.9
- phpunit/phpunit: 4.*
This package is not auto-updated.
Last update: 2024-09-28 08:45:57 UTC
README
一个使与 PowerBI REST API 交互更简单的 SDK。
安装
composer require tangent-solutions/powerbi-sdk
使用
您首先需要获取一个授权访问令牌。以下是如何使用 League OAuth2 Client 来完成此操作的示例
$provider = new \League\OAuth2\Client\Provider\GenericProvider([ 'clientId' => '<client-id>', 'clientSecret' => '<client-secret>', 'urlAuthorize' => 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize', 'urlAccessToken' => 'https://login.windows.net/<tenant-id>/oauth2/token', 'urlResourceOwnerDetails' => '', 'scopes' => 'openid', ]); try { // Try to get an access token using the resource owner password credentials grant. $accessToken = $provider->getAccessToken('password', [ 'username' => '<Azure-Username>', 'password' => '<Azure-Password>', 'resource' => 'https://analysis.windows.net/powerbi/api' ]); $token = $accessToken->getToken(); } catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) { // Failed to get the access token exit($e->getMessage()); }
一旦您有了访问令牌,您就可以这样创建客户端
$client = new \Tngnt\PBI\Client($token);
文档
问题
在存储库的 问题 选项卡上查看或记录问题。
版权和许可
版权所有 (c) Tangent Solutions。保留所有权利。在 MIT 许可 下授权。