crademaker/bexio-api-client
Composer 安装命令:
composer require crademaker/bexio-api-client
包简介
Framework-independent bexio API client for PHP
README 文档
README
Framework-unabhaengiger, PSR-18-basierter bexio API Client fuer PHP mit vollstaendiger, aus der offiziellen bexio-Dokumentation generierter API-Oberflaeche.
Status
Das Projekt ist bewusst als Neubau gestartet. Die Entscheidung dazu ist dokumentiert in docs/analysis/fork-vs-rebuild.md. Die API-Oberflaeche umfasst aktuell 318 dokumentierte HTTP-Operationen in 58 Ressourcenklassen, generiert aus der offiziellen bexio-Dokumentation.
Installation
composer require crademaker/bexio-api-client
Für eine konkrete HTTP-Implementierung brauchst du zusätzlich einen PSR-18-Client und PSR-17-Fabriken, zum Beispiel mit Guzzle:
composer require guzzlehttp/guzzle guzzlehttp/psr7
Schnellstart mit Personal Access Token
<?php declare(strict_types=1); use Crademaker\BexioApiClient\Auth\StaticTokenProvider; use Crademaker\BexioApiClient\Http\BexioClient; use GuzzleHttp\Client as GuzzleClient; use GuzzleHttp\Psr7\HttpFactory; $httpClient = new GuzzleClient(); $httpFactory = new HttpFactory(); $client = new BexioClient( $httpClient, $httpFactory, $httpFactory, new StaticTokenProvider('your-personal-access-token'), ); $contacts = $client->contacts()->v2ListContacts([ 'limit' => 20, ]);
Vollstaendige API-Oberflaeche
Die Ressourcenzugriffe orientieren sich an den offiziellen Tags der bexio-Dokumentation. Beispiele:
$client->contacts()$client->invoices()$client->files()$client->projects()$client->qrPayments()
Die Methoden orientieren sich an den offiziellen operationIds der Doku. Beispiele:
$contact = $client->contacts()->v2ShowContact([ 'contact_id' => 123, ]); $matches = $client->contacts()->v2SearchContact( [ [ 'field' => 'name_1', 'value' => 'Example Company', 'criteria' => '=', ], ], ['limit' => 20], ); $created = $client->files()->v3CreateFile( [ 'name' => 'example.pdf', 'file' => [ 'contents' => file_get_contents('/path/to/example.pdf'), 'filename' => 'example.pdf', 'content_type' => 'application/pdf', ], ], );
Signaturmuster:
- Operation ohne Path- und Body-Parameter:
method(array $query = [], array $headers = []) - Operation mit Path-Parametern:
method(array $path, array $query = [], array $headers = []) - Operation mit Body:
method(array $body, array $query = [], array $headers = []) - Operation mit Path und Body:
method(array $path, array $body, array $query = [], array $headers = [])
Die vollstaendige Resource- und Methodenliste steht in docs/api/endpoint-catalog.md.
Implementierungsbeispiele
- Beispiele: examples
- Begleitdoku: docs/usage/implementation-examples.md
OAuth2 / Refresh Tokens
<?php declare(strict_types=1); use Crademaker\BexioApiClient\Auth\InMemoryTokenStore; use Crademaker\BexioApiClient\Auth\OAuthTokenService; use Crademaker\BexioApiClient\Auth\RefreshableTokenProvider; use Crademaker\BexioApiClient\Auth\TokenSet; use Crademaker\BexioApiClient\Http\BexioClient; use GuzzleHttp\Client as GuzzleClient; use GuzzleHttp\Psr7\HttpFactory; $httpClient = new GuzzleClient(); $httpFactory = new HttpFactory(); $tokenStore = new InMemoryTokenStore( new TokenSet( accessToken: 'initial-access-token', refreshToken: 'refresh-token', ), ); $oauth = new OAuthTokenService($httpClient, $httpFactory, $httpFactory); $provider = new RefreshableTokenProvider( clientId: 'client-id', clientSecret: 'client-secret', tokenStore: $tokenStore, tokenService: $oauth, scopes: ['openid', 'offline_access', 'contact_show'], ); $client = new BexioClient($httpClient, $httpFactory, $httpFactory, $provider);
Eine Authorization URL für den initialen Consent-Flow kann so erzeugt werden:
$authorizationUrl = $oauth->buildAuthorizationUrl( clientId: 'client-id', redirectUri: 'https://app.example.com/callback', scopes: ['openid', 'offline_access', 'contact_show'], state: 'csrf-token', );
Fehlerbehandlung
Der Client mappt API-Fehler auf eigene Exceptions:
AuthenticationExceptionAuthorizationExceptionValidationExceptionNotFoundExceptionRateLimitExceptionServerExceptionApiExceptionTransportException
Architektur
- Analyse: docs/analysis/fork-vs-rebuild.md
- Zielarchitektur: docs/architecture/target-architecture.md
- Roadmap: docs/roadmap/endpoint-roadmap.md
- API-Katalog: docs/api/endpoint-catalog.md
- Implementierungsbeispiele: docs/usage/implementation-examples.md
- Mitarbeit / Regeneration: CONTRIBUTING.md
Qualitätssicherung
composer validate --strict
composer test
composer analyse
composer cs:check
crademaker/bexio-api-client 适用场景与选型建议
crademaker/bexio-api-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「client」 「oauth2」 「composer」 「bexio」 「psr-18」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 crademaker/bexio-api-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 crademaker/bexio-api-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 crademaker/bexio-api-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.
A PSR-7 compatible library for making CRUD API endpoints
Mock PSR-18 HTTP client
Email Toolkit Plugin for CakePHP
Asynchronous MQTT client built on React
The missing social authentication for thephpleague/oauth2-server, adapted from schedula/league-oauth2-social
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-09