Skip to content

Adapters ​

Adapters wrap third-party SDKs and implement the core package's contracts. Install one and you get a working integration with logging, retries, rate limiting, and health tracking out of the box.

Official adapters ​

The pocketarc/laravel-integrations-adapters package has officially maintained adapters:

AdapterSDKFocus
GitHubknplabs/github-apiIssues
Zendeskzendesk/zendesk_api_client_phpTickets, users, comments
Stripestripe/stripe-phpPayment intents (saving cards and off-session charges), setup intents, payment methods, refunds, charges, customers, disputes, events, webhooks
Postmarkwildbit/postmark-phpMail credentials bridge, typed webhooks (delivery/bounce/open/click/spam/subscription/inbound), bounces, suppressions, messages, server stats, webhook endpoints

These adapters aren't fully API-complete -- they cover what's needed for the projects that use them. You can extend them or build your own.

Installation ​

bash
composer require pocketarc/laravel-integrations-adapters

Adapters 8.0.0 or later require PHP's ext-curl extension and lib-curl >=7.59.0. The package also requires symfony/polyfill-intl-idn (^1.18), which Composer installs as a dependency.

Register the adapters you need in config/integrations.php:

php
'providers' => [
    'zendesk'  => \Integrations\Adapters\Zendesk\ZendeskProvider::class,
    'github'   => \Integrations\Adapters\GitHub\GitHubProvider::class,
    'stripe'   => \Integrations\Adapters\Stripe\StripeProvider::class,
    'postmark' => \Integrations\Adapters\Postmark\PostmarkProvider::class,
],

Downloading files ​

With adapters 8.0.0 or later, GitHub asset downloads and Zendesk attachment downloads use Integrations\Adapters\Http\PublicUrlFetcher. Downloads still run through the integration's request pipeline, outside the provider SDK.

URLs and redirects ​

The fetcher accepts only http and https URLs with a host and no user name or password. It canonicalizes each host: scheme and host case are normalized, a trailing dot is removed, internationalized names are converted to ASCII, and IPv6 literals are normalized. It refuses percent-encoded hosts, invalid hostnames, IPv6 zone IDs and non-standard IPv4 forms such as 2130706433, 0x7f.1, 0177.0.0.1 and 127.1.

It follows 301, 302, 303, 307 and 308 redirects itself, up to five redirects (six requests including the first). Relative locations are resolved against the current URL. Each target is parsed and checked again. A redirect without a Location, or another redirect after the limit, causes a RuntimeException.

Every resolved IPv4 and IPv6 address must pass PHP's FILTER_FLAG_GLOBAL_RANGE check. A host with no addresses, or with any non-global address, is refused. This includes private, loopback, link-local and shared address space (CGNAT/Tailscale). Literal IP addresses are checked too. For hostnames, each fresh cURL connection is pinned to the checked addresses; cURL cannot choose a different address from a second DNS lookup. Downloads bypass application and environment proxies.

Headers and credentials ​

Caller headers and the application's default headers are sent only over HTTPS to the first URL's origin (scheme, canonical host and port). The exceptions are Accept, Accept-Encoding, Accept-Language and User-Agent, which can be sent on every hop. On other origins and over HTTP, all other caller headers are removed and Host is set to the current target's authority. Authorization headers follow the same rule. The global auth option is cleared on every hop.

The adapters' own credentials differ: see GitHub token handling and Zendesk attachment downloads.

Size limit and failures ​

Each response has a default limit of 50 MiB (52,428,800 bytes). Integrations\Adapters\Http\DownloadTooLarge extends RuntimeException and is thrown when a Content-Length containing only decimal digits exceeds the limit, or when the decoded bytes written during the transfer exceed it. A body exactly at the limit is accepted. The limit also applies to redirect responses.

The adapters package reads integrations.adapters.max_download_bytes; the core package does not. Only a PHP integer of at least 1 is used. Other values, including the numeric string '1000', use the default. The key is absent from the core's published config. See adapter configuration for the entry in the application's config/integrations.php.

PublicUrlFetcher::get() returns an Illuminate\Http\Client\Response. It throws RuntimeException for refused URLs, unresolved or blocked addresses, invalid redirects and refused HTTP client options. Malformed URIs can also raise InvalidArgumentException. With the default client options, HTTP 4xx and 5xx responses throw Illuminate\Http\Client\RequestException, and connection failures throw Illuminate\Http\Client\ConnectionException.

Both adapters' download() methods return the response body as ?string. When app.debug is true, they rethrow these failures, including DownloadTooLarge. Otherwise, they log and report the exception and return null.

HTTP client options ​

The fetcher checks the merged options from Laravel's Http::globalOptions(). The inherited allowlist is:

OptionBehaviour
connect_timeout, read_timeoutInherited connection and read timeouts
crypto_method, crypto_method_maxInherited TLS version settings
headersInherited, with the per-hop filtering above
http_errorsInherited; the final Laravel response is still checked with throw()
on_statsInherited transfer statistics callback
verifyInherited, but false is refused. A CA bundle path is accepted
versionInherited HTTP protocol version

The fetcher sets its own timeout (120 seconds by default), disables automatic redirects and streaming, bypasses proxies, and enables content decoding. It also sets force_ip_resolve to null and idn_conversion to false, clears auth, and supplies its own curl, sink and on_headers options. These options must match the fetcher's values after merging.

An application-supplied handler, extra curl options, verify => false, client certificates (cert, ssl_key), cookies, query, body options (body, json, form_params, multipart), debug, base_uri, stream_context and every other unknown option are refused with a RuntimeException. The option error names the refused key, or states that certificate verification is disabled.

Host resolver ​

DNS lookups use Integrations\Adapters\Http\HostResolver::resolve(string $host): array, which returns every IPv4 and IPv6 address for the host, or an empty array if it cannot resolve. Literal IP URLs do not use the resolver. DnsHostResolver looks up A and AAAA records and removes duplicates. The service provider registers it with bindIf, preserving an application's existing HostResolver binding. Addresses from a custom resolver still undergo the global-range check.

Http::fake() still intercepts downloads when the fetcher sets CurlHandler, but hostname resolution happens before the fake HTTP response. See testing downloads for a fake resolver and HTTP response. For migration steps, see Adapters 7 to 8.

Community adapters ​

If you've built an adapter for a service, open an issue or PR on the laravel-integrations repository and it can be listed here.

Building your own ​

Whether you want to contribute to the official adapters package or release your own, see Building Adapters for the conventions and patterns to follow.