rabosh / laravel
Laravel SDK for pushing billing events to the Rabosh billing platform
1.0.0
2026-04-22 19:38 UTC
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.0
- illuminate/support: ^10.0|^11.0|^12.0
README
Laravel package for pushing billing events to the Rabosh billing platform.
Installation
composer require rabosh/laravel
Configuration
Publish the config file:
php artisan vendor:publish --tag=rabosh-config
Add to your .env:
RABOSH_API_KEY=your-api-key
RABOSH_API_SECRET=your-api-secret
Optionally override the API URL (defaults to https://api.rabosh.com):
RABOSH_BASE_URL=https://custom-instance.example.com
Usage
Push a billing event
use Rabosh\Facades\Rabosh;
// Simple event
Rabosh::event('api.request', [
'endpoint' => '/users',
'method' => 'GET',
]);
// With timestamp
Rabosh::event('sms.sent', [
'recipient' => '+1234567890',
'segments' => 2,
], now()->toIso8601String());
Async (queued) events
Enable in .env:
RABOSH_QUEUE_ENABLED=true
RABOSH_QUEUE_CONNECTION=redis
RABOSH_QUEUE_NAME=billing
Rabosh::eventAsync('api.request', ['endpoint' => '/users']);
Dependency injection
use Rabosh\RaboshClient;
class MyService
{
public function __construct(private RaboshClient $rabosh) {}
public function doWork(): void
{
$this->rabosh->event('work.completed', ['duration_ms' => 150]);
}
}
Error Handling
use Rabosh\Exceptions\RaboshAuthException;
use Rabosh\Exceptions\RaboshApiException;
try {
Rabosh::event('api.request', ['endpoint' => '/users']);
} catch (RaboshAuthException $e) {
// Invalid API key or secret
} catch (RaboshApiException $e) {
// Server error, validation error, etc.
}