Skip to content

Providers

A provider defines how your app talks to an external service. Every provider must implement the IntegrationProvider interface. Optional interfaces add capabilities like OAuth2, sync scheduling, webhooks, and more.

The IntegrationProvider interface

php
use Integrations\Contracts\IntegrationProvider;

interface IntegrationProvider
{
    public function name(): string;
    public function credentialRules(): array;       // Laravel validation rules
    public function metadataRules(): array;         // Laravel validation rules
    public function credentialDataClass(): ?string;  // Spatie Data class or null
    public function metadataDataClass(): ?string;    // Spatie Data class or null
}
MethodDescription
name()Human-readable name shown in logs and commands
credentialRules()Laravel validation rules for the credentials array (validated on create/update)
metadataRules()Laravel validation rules for the metadata array
credentialDataClass()Optional Spatie Data class for typed credential access (see Credentials & Metadata)
metadataDataClass()Optional Spatie Data class for typed metadata access

Registration

Register providers in config/integrations.php:

php
'providers' => [
    'github'  => App\Integrations\GitHubProvider::class,
],

Or programmatically via the facade:

php
use Integrations\Facades\Integrations;

Integrations::register('github', GitHubProvider::class);

The key ('github') is the provider identifier stored in the Integration model's provider column.

Optional interfaces

Providers can opt into additional capabilities by implementing these interfaces:

InterfacePurpose
IntegrationProviderRequired. Name, credential/metadata rules and Data classes.
HasScheduledSyncScheduled sync support with rate limits.
HandlesWebhooksInbound webhook handling with signature verification.
HasOAuth2OAuth2 authorization flow with token refresh.
HasHealthCheckLightweight connection testing.
RedactsRequestDataRedact sensitive fields from stored request/response data.
HasIncrementalSyncDelta sync with cursor support (extends HasScheduledSync).
CustomizesRetryProvider-specific retry decisions and delay logic.

Each interface is documented in detail on its feature page:

Full interface signatures are in the Contracts Reference.