定制 christianruhstaller/bexio-api-php-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

christianruhstaller/bexio-api-php-client

最新稳定版本:0.3.0

Composer 安装命令:

composer require christianruhstaller/bexio-api-php-client

包简介

Client library for bexio API

README 文档

README

The bexio API Client Library enables you to work with the bexio API. This is an early version and is still in development.

See the bexio API documentation for more information how to use the API.

Installation

You can use Composer or download the library.

Require this package with composer:

composer require christianruhstaller/bexio-api-php-client

Include the autoloader:

require_once '/path/to/your-project/vendor/autoload.php';

Examples

Get access token

require_once '../vendor/autoload.php'; $clientId = 'CLIENT_ID'; // The client id of your app $clientSecret = 'CLIENT_SECRET'; // The client secret of your app $redirectUri = 'http://localhost/bexio-api-php-client.php'; // Set here your Url where this script gets called $scope = 'openid offline_access'; // A whitespace-separated list of scopes (see https://docs.bexio.com/#section/Authentication/API-Scopes). $state = '8OTs2JTDcWDaPqV7o9aHVWqM'; // A random sequence. Should be used as a protection against CSRF-Attacks $credentialsPath = 'client_credentials.json'; // Set the path where the credentials file will be stored $client = new \Bexio\Client( [ 'clientId' => $clientId, 'clientSecret' => $clientSecret, ] ); $client->setRedirectUri($redirectUri); // If code is not set we need to get the authentication code if (!isset($_GET['code'])) { $redirectTo = \Bexio\Client::OAUTH2_AUTH_URL.'?'.http_build_query( [ 'response_type' => 'code', 'client_id' => $clientId, 'redirect_uri' => $redirectUri, 'scope' => $scope, 'state' => $state, ] ); header('Location: '.$redirectTo); exit; } else { $accessToken = $client->fetchAccessTokenWithAuthCode($_GET['code']); file_put_contents($credentialsFile, json_encode($accessToken)); exit; }

Init client

 require_once '../vendor/autoload.php'; $client = new \Bexio\Client([ 'clientId' => 'CLIENT_ID', 'clientSecret' => 'CLIENT_SECRET', ]); $credentialsPath = 'PATH_TO_CREDENTIAL_FILE'; if (!file_exists($credentialsPath)) { throw new \Exception('Credentials file not found for OAuth: '.$credentialsPath); } $accessToken = file_get_contents($credentialsPath); $client->setAccessToken($accessToken); if ($client->isAccessTokenExpired()) { $client->refreshToken($client->getRefreshToken()); file_put_contents($credentialsPath, $client->getAccessToken()); }

Get contacts

 $bexio = new \Bexio\Resource\Contact($client); $contacts = $bexio->getContacts();

统计信息

  • 总下载量: 32.84k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 11
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 4
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固