speedfin/speedfin-wrapper
最新稳定版本:1.0.2
Composer 安装命令:
composer require speedfin/speedfin-wrapper
包简介
Speedfin 2.0 API wrapper for Finance Admin (clients, documents, etc.)
README 文档
README
A lightweight wrapper layer to communicate with Speedfin 2.0 API from external applications (e.g., Finance Admin).
Modules
- ClientService (CRUD dla klientów: getAll, getById, create, update, delete)
Instalacja
composer install
Konfiguracja i użycie (przykład w Finance Admin)
- Zainstaluj paczkę lub dołącz repozytorium jako path repository (jeśli monorepo).
- Skonfiguruj serwis w Symfony:
# services.yaml (fragment)
services:
SpeedfinWrapper\Client\SpeedfinApiClient:
arguments:
$baseUrl: '%env(SPEEDFIN_API_URL)%'
$timeout: 30
SpeedfinWrapper\Service\ClientService:
arguments:
$client: '@SpeedfinWrapper\\Client\\SpeedfinApiClient'
- Użycie w kodzie:
use SpeedfinWrapper\Service\ClientService;
use SpeedfinWrapper\Dto\Client\ClientDto;
$clientService = $container->get(ClientService::class);
// Pobranie listy
$clients = $clientService->getAll();
// Pobranie po ID
$client = $clientService->getById(123);
// Utworzenie klienta
$new = new ClientDto(name: 'Jan', surname: 'Kowalski', email: 'jan@example.com');
$created = $clientService->create($new);
// Aktualizacja klienta
$created->comment = 'Ważny klient';
$updated = $clientService->save($created);
// Usunięcie
$clientService->delete($updated->id);
Uwagi
- Endpointy oparte na Api Platform (prefiks
/api). - PATCH używa
application/merge-patch+json. - Autoryzacja Bearer przez przekazanie tokena po logowaniu.
Ustawienie tokena po logowaniu
Przekaż token uzyskany przy logowaniu bezpośrednio do klienta:
use SpeedfinWrapper\Client\SpeedfinApiClient;
$apiClient = $container->get(SpeedfinApiClient::class);
$apiClient->setToken($tokenUzyskanyPrzyLogowaniu);
// Od tego momentu wszystkie wywołania będą używać ustawionego tokena
统计信息
- 总下载量: 36
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2025-10-17