Search by

community-sdks / laravel-cloud-php

A strongly typed, framework-agnostic PHP SDK for the Laravel Cloud API.

Maintainers

Package info

github.com/community-sdks/laravel-cloud-php

pkg:composer/community-sdks/laravel-cloud-php

Transparency log

Statistics

Installs: 12

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-09-03 21:37 UTC

This package is auto-updated.

Last update: 2026-09-03 21:37:25 UTC


README

A strongly typed, framework-agnostic PHP SDK for the Laravel Cloud REST API, maintained by Community SDKs.

This is a community-maintained project and is not an official Laravel package.

Documentation

The documentation hub contains getting-started guidance, authentication, client configuration, API contract policy, error handling, and a navigable service-by-service endpoint reference.

Each service has its own page. As endpoint contracts are supplied and implemented, those pages will document the PHP method, HTTP route, typed request and response objects, exceptions, and complete usage examples.

Requirements

  • PHP 8.3 or newer (including PHP 8.5 and the PHP versions supported by Laravel 13)
  • JSON extension

The SDK deliberately has no dependency on Laravel or Illuminate, so it can be used in Laravel applications and standalone PHP projects alike.

Installation

composer require community-sdks/laravel-cloud-php

Authentication and client creation

Create a client with a Laravel Cloud API token:

use CommunitySDKs\LaravelCloud\Client;

$cloud = new Client(
    token: $_ENV['LARAVEL_CLOUD_TOKEN'],
);

The client sends the token as a Bearer credential and uses https://cloud.laravel.com/api/ by default. A custom base URI, request timeout, connect timeout, or Guzzle client can be supplied for advanced usage and testing.

Services

Services are typed, created lazily, and reused. The following services currently have documented endpoint implementations:

Service Client accessor Implemented operations
Applications applications() List, get, create, update, delete, upload avatar, and delete avatar.
Environments environments() Lifecycle, configuration, variables, secrets, logs, metrics, edge cache, and vanity domains.
Domains domains() List, create, get, update, verify, and delete.
Caches caches() List, create, get, update, metrics, available types, and delete.
Commands commands() List, run, and get.
Edge Networks edgeNetworks() List available edge networks.

For example:

$applications = $cloud->applications();
$domains = $cloud->domains();
$caches = $cloud->caches();
$commands = $cloud->commands();

Accessors also exist for the other known Laravel Cloud API groups so future endpoints can be added without changing how the client is organized. An accessor does not imply that its endpoint contract has already been implemented.

See the complete service index for individual service pages and endpoint implementation status.

Strong typing

Endpoint request bodies use immutable request DTOs. Responses are hydrated into typed JSON:API resource graphs with scalar string identifiers, native enums, exact nullability, typed relationships, and DateTimeImmutable values. Generic decoded arrays remain confined to the internal HTTP boundary.

List applications

use CommunitySDKs\LaravelCloud\DTO\Requests\Applications\ListApplicationsRequest;
use CommunitySDKs\LaravelCloud\Enums\Applications\ApplicationInclude;

$applications = $cloud->applications()->list(new ListApplicationsRequest(
    region: 'eu-central-1',
    include: [ApplicationInclude::Environments],
));

foreach ($applications->data as $application) {
    echo $application->attributes?->name ?? $application->id;
}

See the Applications endpoint reference for filters, included resource types, pagination, and error behavior.

Error handling

HTTP and transport failures are exposed through SDK exceptions rooted at LaravelCloudException. Specific exceptions cover authentication, authorization, missing resources, validation, rate limits, server responses, and network failures. API exceptions preserve the status code, raw response body, and a parsed API message when available.

Development

composer install
composer check

composer check verifies formatting, runs PHPStan at maximum level, and executes PHPUnit without making network requests.

Current status

The transport, configuration, exception hierarchy, service registry, test tooling, and static-analysis foundation are implemented. Typed endpoints are currently available for applications, environments, domains, caches, commands, and edge networks. Additional services will be implemented endpoint-by-endpoint from the official Laravel Cloud OpenAPI contracts; undocumented schemas are intentionally not guessed.