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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners