Download the PHP package imamnc/efihub-client without Composer
On this page you can find all versions of the php package imamnc/efihub-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package efihub-client
Laravel EFIHUB Client
Package Laravel untuk integrasi dengan EFIHUB API menggunakan OAuth2 Client Credentials Flow dengan automatic token management dan caching.
Fitur
- ✅ OAuth2 Client Credentials authentication
- ✅ Automatic access token management dan caching
- ✅ Token refresh otomatis saat expired
- ✅ HTTP client wrapper dengan error handling
- ✅ Laravel Facade support
- ✅ Service Provider auto-discovery
- ✅ Konfigurasi environment-based
Instalasi
1. Install via Composer
2. Publish Configuration
3. Environment Configuration
Tambahkan konfigurasi berikut ke file .env
:
Penggunaan
Menggunakan Facade
Menggunakan Dependency Injection
Response Handling
Konfigurasi
File konfigurasi tersedia di config/efihub.php
setelah publishing:
Token Management
Package ini secara otomatis menangani:
- Token Caching: Access token di-cache selama 55 menit
- Auto Refresh: Token otomatis di-refresh saat expired (401 response)
- Error Handling: Automatic retry dengan token baru jika terjadi 401 error
API Methods
HTTP Methods
Method | Description |
---|---|
get($endpoint, $options = []) |
HTTP GET request |
post($endpoint, $options = []) |
HTTP POST request |
put($endpoint, $options = []) |
HTTP PUT request |
delete($endpoint, $options = []) |
HTTP DELETE request |
request($method, $endpoint, $options = []) |
Generic HTTP request |
Token Management
Method | Description |
---|---|
getAccessToken() |
Mendapatkan access token (cached) |
Requirements
- PHP ^8.0
- Laravel ^8.0|^9.0|^10.0|^11.0|^12.0
- Guzzle HTTP ^7.0
Contoh Penggunaan Lengkap
Error Handling
Package ini menangani beberapa skenario error:
- Token Fetch Error: Exception akan di-throw jika gagal mendapatkan access token
- 401 Unauthorized: Token otomatis di-refresh dan request di-retry
- Network Errors: Menggunakan Guzzle HTTP error handling
Testing
Untuk testing, Anda dapat mock HTTP responses:
Contributing
- Fork repository
- Buat feature branch (
git checkout -b feature/amazing-feature
) - Commit changes (
git commit -m 'Add amazing feature'
) - Push ke branch (
git push origin feature/amazing-feature
) - Buat Pull Request
License
Package ini menggunakan lisensi MIT. Lihat file LICENSE untuk detail.
Support
Untuk pertanyaan atau masalah, silakan buat issue di GitHub repository.
All versions of efihub-client with dependencies
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0
guzzlehttp/guzzle Version ^7.0