recurly/recurly-client
Official PHP client for Recurly API v3. Install via Composer, create a Client with your API key (supports EU region), and optionally plug in a PSR-3 logger. Provides a single entry point for all Recurly operations with semver releases.
Pros:
Client class can be instantiated and bound to Laravel’s IoC container for easy access across the application.Pager class simplifies handling large datasets, which is critical for Laravel applications managing user subscriptions or billing records.Validation, NotFound, RecurlyError) map neatly to Laravel’s exception handling (e.g., try/catch in controllers or middleware).Cons:
Client class. This may require careful abstraction if the application needs to decouple billing logic from Recurly-specific implementations (e.g., for testing or future flexibility).Recurly\Client to Laravel’s container for dependency injection:
$this->app->singleton(\Recurly\Client::class, function ($app) {
return new \Recurly\Client(config('services.recurly.key'), [
'region' => config('services.recurly.region', 'us'),
'logger' => $app->make(\Psr\Log\LoggerInterface::class),
]);
});
config/services.php:
'recurly' => [
'key' => env('RECURLY_API_KEY'),
'region' => env('RECURLY_REGION', 'us'),
],
RateLimitRemaining header).subscription.created) when Recurly webhooks fire, using the package’s Client to verify webhook signatures.Pager) is lazy-loaded, but bulk operations (e.g., listAccounts) could strain API rate limits. Implement caching (e.g., Laravel Cache) for frequent queries..env (never in code) and restrict access via IAM or Laravel’s config/caching.DEBUG level logs in production).Client in a custom service (e.g., SubscriptionService) to decouple Recurly-specific logic from business rules?queue:work process them, or will a dedicated service (e.g., Laravel Echo/Pusher) manage real-time updates?tenant() middleware or a package like spatie/laravel-multitenancy.throttle middleware for API routes.Recurly\Client can be registered as a singleton or context-bound service, injected into controllers, commands, or jobs.config/services.php and .env files.createInvoice).SubscriptionActivated) when Recurly operations complete.Client in PHPUnit/Pest tests using Laravel’s Mockery or createMock.composer.json).User, Subscription) to Recurly resources (e.g., Account, Plan).Client for fetching subscription statuses.observers or model events to update local DB on Recurly changes).deprecated() helper to warn about obsolete code.curl, json, and openssl extensions are enabled (required by Guzzle).get*, list*, and count* methods for data retrieval.getSubscription() method with $client->getSubscription($id).create*, update*, and delete* methods for modifying Recurly data.$client->createInvoice() instead of a custom invoice service.subscription_canceled events and trigger Laravel notifications.How can I help you explore Laravel packages today?