Contents

October\Rain\Installer\GatewayClient

Overview

Gateway Client

A standalone PHP client for the October CMS Gateway V1 API. No external dependencies required - works with PHP 7.4+

Usage: // Account-level operations (HMAC auth) $client = (new GatewayClient)->setCredentials('your-api-key', 'your-api-secret'); $projects = $client->listProjects();

// Project-level operations (uses license key or auth.json hash) $client = (new GatewayClient)->setProjectHash('your-license-key-or-hash'); $updates = $client->checkForUpdates(['plugins' => [...], 'themes' => [...]]);


Protected Properties

protected string|null $apiKey

apiKey for HMAC authentication

protected string|null $apiSecret

apiSecret for HMAC authentication

protected string|null $projectHash

projectHash for project-level authentication (license key or auth.json hash)

protected int $timeout

timeout in seconds

protected array $lastResponseHeaders

protected int $lastStatusCode

protected string|null $lastErrorCode

lastErrorCode from API response


Public Methods

public attachPackage()

public attachPackage(
    int $projectId,
    string $packageCode,
    string $type
): array 

attachPackage attaches a package to a project

public browsePackages()

public browsePackages(
    int $page = 1,
    string $type = 'plugin',
    int|null $version = null
): array 

browsePackages returns a paginated list of packages

public checkForUpdates()

public checkForUpdates(array $options = []): array 

checkForUpdates checks for available updates (project-level auth)

public createProject()

public createProject(string $name, array $options = []): array 

createProject creates a new project

public deleteProject()

public deleteProject(int $projectId): array 

deleteProject deletes a project

public detachPackage()

public detachPackage(
    int $projectId,
    string $packageCode,
    string $type
): array 

detachPackage detaches a package from a project

public getInstallDetail()

public getInstallDetail(): array 

getInstallDetail returns installation details

public getLastErrorCode()

public getLastErrorCode(): string|null 

getLastErrorCode returns the API error code from the last failed request

public getLastResponseSignature()

public getLastResponseSignature(): string|null 

getLastResponseSignature returns the last response signature for verification

public getLastStatusCode()

public getLastStatusCode(): int 

getLastStatusCode returns the last HTTP status code

public getPackage()

public getPackage(string $code, string $type = 'plugin'): array 

getPackage returns single package details

public getPackageContent()

public getPackageContent(string $code, string $type = 'plugin'): array 

getPackageContent returns package documentation content

public getPackages()

public getPackages(array $codes, string $type = 'plugin'): array 

getPackages returns multiple package details

public getProject()

public getProject(int $projectId): array 

getProject returns detailed information about a project

public getProjectDetail()

public getProjectDetail(string|null $projectHash = null): array 

getProjectDetail returns project details (project-level auth)

public getRetryAfter()

public getRetryAfter(): int|null 

getRetryAfter returns the Retry-After header value (for rate limiting)

public isAuthError()

public isAuthError(): bool 

isAuthError checks if the last error was an authentication error

public isRateLimited()

public isRateLimited(): bool 

isRateLimited checks if the last error was a rate limit error

public isValidationError()

public isValidationError(): bool 

isValidationError checks if the last error was a validation error

public listProjects()

public listProjects(
    int $limit = 50,
    string|null $cursor = null
): array 

listProjects returns all projects for the account

public lookupByDomain()

public lookupByDomain(string $domainName): array 

lookupByDomain looks up a project by domain name

public rotateLicense()

public rotateLicense(int $projectId): array 

rotateLicense regenerates a license key

public searchPackages()

public searchPackages(string $query, string|null $type = null): array 

searchPackages searches for packages

public setCredentials()

public setCredentials($apiKey, $apiSecret): self 

setCredentials for account-level authentication

public setProjectHash()

public setProjectHash(string $projectHash): self 

setProjectHash for project-level authentication

public setTimeout()

public setTimeout($seconds): self 

setTimeout for requests

public updateProject()

public updateProject(int $projectId, array $options = []): array 

updateProject updates an existing project

Protected Methods

protected parseHeaders()

protected parseHeaders($headerString): array 

parseHeaders extracts headers from response

protected request()

protected request(
    string $endpoint,
    array $params = [],
    string $method = 'POST',
    array $headers = []
): array 

request makes an HTTP request

protected requestWithHmac()

protected requestWithHmac($endpoint, $params): array 

requestWithHmac makes a request with HMAC authentication

protected requestWithProject()

protected requestWithProject($endpoint, $params): array 

requestWithProject makes a request with project-level authentication