TheDocumentation Index
Fetch the complete documentation index at: https://danestvesllc-2b77d201.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
LaravelPolar facade wraps the most common Polar operations with Laravel-idiomatic helpers. It doesn’t wrap every endpoint that the Polar PHP SDK exposes. For anything not covered — customer portal wallets, file creation and deletion, OAuth2 flows, organization updates, and more — drop straight into the underlying SDK client via LaravelPolar::sdk().
This is the documented, supported escape hatch. The facade covers the common cases; sdk() covers the long tail.
What sdk() returns
sdk() returns a Polar\Polar instance — the official Polar PHP SDK client. The package constructs and caches this instance the first time it is needed, using your polar.access_token and polar.server config values. Subsequent calls in the same request return the same instance.
When to use sdk() directly
Reach for sdk() when:
- You need an endpoint the
LaravelPolarfacade does not wrap (see examples below). - You want finer-grained control over the raw request or response payload.
- You are building a one-off admin script or a non-standard integration.
Examples
Customer portal wallets
Creating a file
The facade exposeslistFiles() for reading, but file creation goes through the SDK directly:
Updating an organization
OAuth2 flows
Using sdk() in a service class
A common pattern is to inject a service that calls LaravelPolar::sdk() internally, keeping SDK calls out of your controllers:
Testing with a mock SDK
The package exposes two testing helpers so you can swap the SDK instance in tests without hitting the real API:setSdk() in your test setUp to provide a pre-configured mock or fake, and resetSdk() in tearDown to clean up.
Further reading
- Polar PHP SDK on GitHub — full list of available namespaces, request types, and response shapes.
- LaravelPolar facade reference — all methods the facade wraps, so you know what is already covered.