Source: juststeveking.uk

Eloquent API Calls
Time and again, I have spoken about API integrations, and each time I find an improvement from the last, once more into the fray. This stood out as it somewhat mirrored how I do API integrations and inspired me to add my own two cents.

I feel like I can expand upon it a little with my lessons learned in API development and integrations.

/** * @mixin ResourceContract */ trait CanAccessClient { public function __construct( private readonly ClientContract $client, ) {} public function client(): ClientContract { return $this->client; }}

final class Client implements ClientContract { use SendsRequests; public function __construct( private readonly PendingRequest $request, ) {} public function issues(): IssuesResource { return new IssuesResource( client: $this, ); }}
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners