PHPackages                             redberry/laravel-cloud-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. redberry/laravel-cloud-sdk

ActiveLibrary[API Development](/categories/api)

redberry/laravel-cloud-sdk
==========================

A fluent PHP SDK for the Laravel Cloud API

v1.1.0(2mo ago)13[2 PRs](https://github.com/RedberryProducts/laravel-cloud-sdk/pulls)MITPHPPHP ^8.3CI passing

Since Apr 20Pushed 1mo agoCompare

[ Source](https://github.com/RedberryProducts/laravel-cloud-sdk)[ Packagist](https://packagist.org/packages/redberry/laravel-cloud-sdk)[ Docs](https://github.com/RedberryProducts/laravel-cloud-sdk)[ GitHub Sponsors](https://github.com/Redberry)[ RSS](/packages/redberry-laravel-cloud-sdk/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (2)Dependencies (18)Versions (6)Used By (0)

Laravel Cloud SDK
=================

[](#laravel-cloud-sdk)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0ef0cd30ab78213088cb5938cec721f5129f7dd7d522df49685b5b8f31e7fd54/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72656462657272792f6c61726176656c2d636c6f75642d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/redberry/laravel-cloud-sdk)[![GitHub Tests Action Status](https://camo.githubusercontent.com/9672fffdf86bf318cd67acbbcdfbee2c43108bac84a332ede4ec86c9938eefee/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f526564626572727950726f64756374732f6c61726176656c2d636c6f75642d73646b2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/RedberryProducts/laravel-cloud-sdk/actions?query=workflow%3Arun-tests+branch%3Amain)[![Code Coverage](https://camo.githubusercontent.com/edfef6a6666e326023db9196737c741dfb874f48f215b7dea286520c50771bad/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f526564626572727950726f64756374732f6c61726176656c2d636c6f75642d73646b3f7374796c653d666c61742d737175617265266c6f676f3d636f6465636f76)](https://codecov.io/gh/RedberryProducts/laravel-cloud-sdk)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/79faf7fddf675ccd595f0eedc6a75bb5bb1c0213841c6967a9508531cec15406/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f526564626572727950726f64756374732f6c61726176656c2d636c6f75642d73646b2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/RedberryProducts/laravel-cloud-sdk/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/04e04f100dbbd41d53780cff073d99b3a5e1b900ff21ee87378fb3dc914a7bee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72656462657272792f6c61726176656c2d636c6f75642d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/redberry/laravel-cloud-sdk)

A fluent, expressive PHP SDK for the [Laravel Cloud](https://cloud.laravel.com) API. Manage your applications, environments, databases, caches, object storage, and more - directly from your Laravel application.

> This is a community-maintained SDK. It is not officially affiliated with, endorsed by, or supported by Laravel. "Laravel" and "Laravel Cloud" are trademarks of their respective owners.

Requirements
------------

[](#requirements)

Package versionPHPLaravel1.x8.3, 8.411.x, 12.x, 13.xInstallation
------------

[](#installation)

You may install the Laravel Cloud SDK via Composer:

```
composer require redberry/laravel-cloud-sdk
```

The package will automatically register its service provider.

Configuration
-------------

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag=cloud-sdk-config
```

This will create a `config/laravel-cloud-sdk.php` configuration file. You should add your Laravel Cloud API token to your `.env` file:

```
LARAVEL_CLOUD_TOKEN=your-api-token
```

You may generate an API token from your Laravel Cloud account settings.

Usage
-----

[](#usage)

### Creating a Client

[](#creating-a-client)

The most common way to interact with the SDK is through the `LaravelCloud` facade, which automatically uses the API token from your configuration:

```
use Redberry\LaravelCloudSdk\Facades\LaravelCloud;

$applications = LaravelCloud::applications();
```

If you need to provide a token at runtime - for example, when managing multiple Cloud organizations - you may use the `forToken` method:

```
$cloud = LaravelCloud::forToken($user->cloud_token);
$applications = $cloud->applications();
```

You may also instantiate the client directly:

```
use Redberry\LaravelCloudSdk\LaravelCloud;

$cloud = new LaravelCloud($token);
```

### Enums

[](#enums)

The SDK ships with enums for all known API values - regions, PHP versions, database types, statuses, and more. Enums provide type safety and IDE autocompletion, but they are never required. Every method that accepts an enum also accepts a plain string:

```
use Redberry\LaravelCloudSdk\Enums\CloudRegion;
use Redberry\LaravelCloudSdk\Enums\SourceControlProvider;

// Using enums (recommended)
LaravelCloud::createApplication(
    repository: 'my-org/my-repo',
    name: 'my-app',
    region: CloudRegion::UsEast1,
    sourceControlProviderType: SourceControlProvider::Github,
);

// Using strings - equally valid
LaravelCloud::createApplication(
    repository: 'my-org/my-repo',
    name: 'my-app',
    region: 'us-east-1',
    sourceControlProviderType: 'github',
);
```

Response objects return enum instances for known values and fall back to raw strings for values the SDK doesn't yet recognize. This means the SDK never breaks when Laravel Cloud adds new options:

```
$app = LaravelCloud::application('app-123');
$app->region; // CloudRegion::UsEast1

$newRegionApp = LaravelCloud::application('app-456');
$newRegionApp->region; // "ap-northeast-1" (new region the SDK doesn't know about yet - still works)
```

### Pagination

[](#pagination)

Methods that return lists of resources use automatic pagination behind the scenes. The SDK returns `LazyCollection` instances that fetch pages on demand as you iterate, so you never need to manage pagination manually:

```
// Iterates through all pages automatically
$applications = LaravelCloud::applications();

foreach ($applications as $application) {
    echo $application->name;
}

// Standard collection operations work seamlessly
$names = LaravelCloud::applications()->map(fn ($app) => $app->name);
$production = LaravelCloud::environments($appId)->filter(fn ($env) => $env->name === 'production');
```

Because results are lazy, only the pages you actually consume are fetched from the API. If you only need the first result, only one API call is made.

### Response Data Objects

[](#response-data-objects)

Every API response is automatically converted into a strongly-typed data object. You never work with raw arrays or JSON - every property is typed, every enum is resolved, and your IDE can autocomplete every field:

```
$environment = LaravelCloud::environment($environmentId);

$environment->name;             // "production"
$environment->status;           // EnvironmentStatus::Running
$environment->phpMajorVersion;  // PhpVersion::V8_4
$environment->createdAt;        // CarbonImmutable instance
```

Methods that return lists yield `LazyCollection` instances where each item is the same typed data object:

```
$environments = LaravelCloud::environments($applicationId);

$environments->each(function (EnvironmentData $environment) {
    echo $environment->name;
});
```

Each resource section below includes a **Response** toggle documenting all available data object properties.

### Relationships

[](#relationships)

When you retrieve resources - whether a single resource or a list - the SDK automatically loads their related resources. Related data is available as typed properties directly on the response object, with no extra API calls needed:

```
$environment = LaravelCloud::environment($environmentId);

$environment->application;          // ApplicationData
$environment->instances;            // InstanceData[]
$environment->currentDeployment;    // ?DeploymentData
$environment->database;             // ?DatabaseData
$environment->cache;                // ?CacheData

// Relationships are also loaded on list results
$environments = LaravelCloud::environments($applicationId);

$environments->each(function (EnvironmentData $env) {
    echo $env->application->name;           // loaded automatically
    echo count($env->instances) . ' instances';
});

$application = LaravelCloud::application($applicationId);

$application->organization;         // ?OrganizationData
$application->environments;         // EnvironmentData[]
```

Singular relationships return the related data object or `null` if not set. Array relationships return an array of data objects (empty array if none exist).

Each resource section below documents available relationship properties in its **Response** toggle.

### Creating &amp; Updating Resources

[](#creating--updating-resources)

Create and update methods use named parameters for a clean, readable API:

```
$application = LaravelCloud::createApplication(
    repository: 'my-org/my-repo',
    name: 'my-application',
    region: CloudRegion::UsEast1,
    sourceControlProviderType: SourceControlProvider::Github,
);

$application = LaravelCloud::updateApplication($applicationId,
    name: 'new-name',
    slackChannel: '#deployments',
);
```

For updates, only pass the fields you want to change - all other fields remain unchanged.

Every create and update method also has a corresponding `*With` variant that accepts a data object directly. This is useful when you want to build the payload programmatically or reuse it across calls:

```
use Redberry\LaravelCloudSdk\Data\Applications\CreateApplicationData;

$application = LaravelCloud::createApplicationWith(
    new CreateApplicationData(
        repository: 'my-org/my-repo',
        name: 'my-application',
        region: CloudRegion::UsEast1,
        sourceControlProviderType: SourceControlProvider::Github,
    )
);
```

Each resource section below documents all available parameters for its create and update methods.

### Deleting Resources

[](#deleting-resources)

Delete methods accept a resource ID:

```
LaravelCloud::deleteApplication($applicationId);
LaravelCloud::deleteEnvironment($environmentId);
LaravelCloud::deleteDomain($domainId);
```

About Redberry
--------------

[](#about-redberry)

This package is built and maintained by [Redberry](https://redberry.international), one of the few Official Premier Laravel Partner agencies worldwide. With 250+ Laravel projects shipped across 20+ countries, a 200-person team, and over a decade in the Laravel ecosystem, Redberry has helped startups, SMEs, and publicly traded enterprises in regulated industries build SaaS platforms, custom web applications, APIs, and more. [Learn about our Laravel development services](https://redberry.international/laravel-development/).

Table of Contents
-----------------

[](#table-of-contents)

- [Applications](#applications)
- [Environments](#environments)
- [Deployments](#deployments)
- [Instances](#instances)
- [Background Processes](#background-processes)
- [Commands](#commands)
- [Domains](#domains)
- [Database Clusters](#database-clusters)
- [Database Snapshots](#database-snapshots)
- [Databases](#databases)
- [Caches](#caches)
- [Object Storage Buckets](#object-storage-buckets)
- [Bucket Keys](#bucket-keys)
- [Websocket Clusters](#websocket-clusters)
- [Websocket Applications](#websocket-applications)
- [Dedicated Clusters](#dedicated-clusters)
- [Organization](#organization)
- [Regions](#regions)
- [IP Addresses](#ip-addresses)
- [Error Handling](#error-handling)
- [Testing](#testing)

Applications
------------

[](#applications)

Applications are the top-level organizational unit in Laravel Cloud. Each application represents a single Laravel project connected to a source control repository and deployed to a specific region. An application contains one or more [environments](#environments) and serves as the parent for all deployment infrastructure.

### Listing Applications

[](#listing-applications)

```
$applications = LaravelCloud::applications();
```

### Retrieving an Application

[](#retrieving-an-application)

```
$application = LaravelCloud::application($applicationId);
```

### Creating an Application

[](#creating-an-application)

```
$application = LaravelCloud::createApplication(
    repository: 'my-org/my-repo',
    name: 'my-application',
    region: CloudRegion::UsEast1,
    sourceControlProviderType: SourceControlProvider::Github,
);
```

### Updating an Application

[](#updating-an-application)

```
$application = LaravelCloud::updateApplication($applicationId,
    name: 'new-name',
    slackChannel: '#deployments',
);
```

### Deleting an Application

[](#deleting-an-application)

```
LaravelCloud::deleteApplication($applicationId);
```

> **Warning:** Deleting an application removes all of its environments. Shared resources like databases, caches, and buckets are not deleted.

### Application Avatar

[](#application-avatar)

You may upload or remove an application's avatar image:

```
$application = LaravelCloud::uploadApplicationAvatar($applicationId, avatarPath: '/path/to/avatar.png');

LaravelCloud::deleteApplicationAvatar($applicationId);
```

Available parameters for `createApplication`ParameterTypeRequiredDescription`repository``string`YesThe full repository path (e.g., `my-org/my-repo`).`name``string`YesThe display name of the application.`region``string|CloudRegion`YesThe AWS region to deploy to (e.g., `us-east-1`).`sourceControlProviderType``string|SourceControlProvider`YesThe source control provider: `github`, `gitlab`, or `bitbucket`.`clusterId``?string`NoThe compute cluster ID. If omitted, one is assigned automatically.Available parameters for `updateApplication`ParameterTypeRequiredDescription`sourceControlProviderType``string|SourceControlProvider`NoChange the source control provider.`name``string`NoUpdate the display name.`slug``string`NoUpdate the URL-friendly slug.`defaultEnvironmentId``string`NoSet the default environment ID.`repository``string`NoChange the connected repository.`slackChannel``?string`NoSet a Slack channel for notifications. Pass `null` to remove.Response: `ApplicationData`PropertyTypeDescription`id``string`The application ID.`name``string`The display name.`slug``string`The URL-friendly slug.`region``string|CloudRegion`The AWS region (e.g., `us-east-1`).`slackChannel``?string`The Slack notification channel.`avatarUrl``?string`URL of the application avatar.`repository``?ApplicationRepositoryData`Repository info: `fullName` (string), `defaultBranch` (string).`createdAt``?CarbonImmutable`When the application was created.`organization``?OrganizationData`The parent organization.`environments``EnvironmentData[]`All environments belonging to this application.`defaultEnvironment``?EnvironmentData`The default environment.Environments
------------

[](#environments)

Environments represent isolated deployment configurations within an application. Each environment has its own compute instances, resource attachments, environment variables, domains, and deployment settings.

A typical setup might include a **production** environment with larger, non-hibernating instances and a dedicated database cluster, alongside **dev**, **staging**, and **UAT** environments with smaller instances sharing a single database cluster. You can also spin up short-lived environments for feature testing or pull request previews.

When an environment is attached to resources (databases, caches, object storage), Laravel Cloud automatically injects the necessary environment variables - `DB_HOST`, `REDIS_HOST`, `FILESYSTEM_DISK`, and so on.

### Listing Environments

[](#listing-environments)

```
$environments = LaravelCloud::environments($applicationId);
```

### Retrieving an Environment

[](#retrieving-an-environment)

```
$environment = LaravelCloud::environment($environmentId);
```

### Creating an Environment

[](#creating-an-environment)

```
$environment = LaravelCloud::createEnvironment($applicationId,
    name: 'staging',
    branch: 'develop',
);
```

### Updating an Environment

[](#updating-an-environment)

Only pass the fields you want to change. All other fields remain unchanged:

```
use Redberry\LaravelCloudSdk\Enums\PhpVersion;
use Redberry\LaravelCloudSdk\Enums\NodeVersion;

$environment = LaravelCloud::updateEnvironment($environmentId,
    phpVersion: PhpVersion::V8_4,
    nodeVersion: NodeVersion::V22,
    usesPushToDeploy: true,
    buildCommand: 'npm run build',
    deployCommand: 'php artisan migrate --force',
);
```

### Starting &amp; Stopping an Environment

[](#starting--stopping-an-environment)

```
// Start - optionally force a redeploy
$deployment = LaravelCloud::startEnvironment($environmentId, redeploy: true);

// Stop
$environment = LaravelCloud::stopEnvironment($environmentId);
```

### Deleting an Environment

[](#deleting-an-environment)

```
LaravelCloud::deleteEnvironment($environmentId);
```

### Environment Variables

[](#environment-variables)

You may set environment variables using the `EnvironmentVariableMethod::Append` strategy (add or update specific keys) or the `EnvironmentVariableMethod::Set` strategy (replace all variables entirely). Each variable is an array with `key` and `value` entries:

```
use Redberry\LaravelCloudSdk\Enums\EnvironmentVariableMethod;

// Add or update specific variables
$environment = LaravelCloud::setEnvironmentVariables($environmentId,
    method: EnvironmentVariableMethod::Append,
    variables: [
        ['key' => 'APP_DEBUG', 'value' => 'false'],
        ['key' => 'CACHE_DRIVER', 'value' => 'redis'],
    ],
);

// Remove specific variables by key
$environment = LaravelCloud::deleteEnvironmentVariables($environmentId,
    keys: ['APP_DEBUG', 'CACHE_DRIVER'],
);
```

### Environment Metrics

[](#environment-metrics)

Retrieve CPU, memory, and HTTP metrics for an environment:

```
use Redberry\LaravelCloudSdk\Enums\MetricPeriod;

$metrics = LaravelCloud::environmentMetrics($environmentId);

// With a specific time period
$metrics = LaravelCloud::environmentMetrics($environmentId, period: MetricPeriod::SevenDays);
```

Available periods: `6h`, `24h`, `3d`, `7d`, `30d`.

### Environment Logs

[](#environment-logs)

Query application logs with time range filters:

```
use Redberry\LaravelCloudSdk\Enums\LogFilterType;

$logs = LaravelCloud::environmentLogs(
    $environmentId,
    from: '2025-01-01T00:00:00Z',
    to: '2025-01-02T00:00:00Z',
    searchQuery: 'Exception',
    type: LogFilterType::Application,
);

foreach ($logs as $entry) {
    echo "[{$entry->level}] {$entry->message}";
}
```

Log results are automatically paginated using cursor-based pagination and returned as a `LazyCollection`. You may filter by type: `All`, `Application`, or `Access`.

Available parameters for `createEnvironment`ParameterTypeRequiredDescription`name``string`YesThe environment name (e.g., `staging`, `production`).`branch``string`YesThe Git branch to deploy from.`clusterId``?string`NoThe compute cluster ID. If omitted, one is assigned automatically.Available parameters for `updateEnvironment`ParameterTypeRequiredDescription`name``string`NoUpdate the environment's display name.`slug``string`NoUpdate the URL-friendly slug.`color``string|EnvironmentColor`NoThe color label for the dashboard.`branch``string`NoChange the Git branch.`phpVersion``string|PhpVersion`NoThe PHP version (`8.2`, `8.3`, `8.4`, `8.5`). Requires redeployment.`nodeVersion``string|NodeVersion`NoThe Node.js version (`20`, `22`, `24`). Requires redeployment.`buildCommand``?string`NoCommand to run during build (e.g., `npm run build`). Pass `null` to remove.`deployCommand``?string`NoCommand to run before activation (e.g., `php artisan migrate --force`). Pass `null` to remove.`usesPushToDeploy``bool`NoWhether pushing to the branch triggers deployment.`usesDeployHook``bool`NoWhether the deploy hook is enabled.`usesOctane``bool`NoWhether Laravel Octane is enabled.`usesVanityDomain``bool`NoWhether the free `laravel.cloud` subdomain is active.`timeout``int`NoRequest timeout in seconds.`sleepTimeout``int`NoSeconds of inactivity before hibernation (Flex only).`shutdownTimeout``int`NoSeconds to wait for graceful shutdown.`usesPurgeEdgeCacheOnDeploy``bool`NoWhether to purge edge cache after deployment.`nightwatchToken``?string`NoThe Nightwatch monitoring token. Pass `null` to remove.`cacheStrategy``string|CacheStrategy`NoEdge cache strategy.`responseHeadersFrame``string|ResponseHeadersFrame`NoThe `X-Frame-Options` header value.`responseHeadersContentType``string|ResponseHeadersContentType`NoThe `X-Content-Type-Options` header value.`responseHeadersRobotsTag``string|ResponseHeadersRobotsTag`NoThe `X-Robots-Tag` header value.`responseHeadersHsts``?HstsData`NoHSTS configuration object. Fields: `maxAge` (?int), `includeSubdomains` (bool, required), `preload` (bool, required). Pass `null` to disable.`filesystemKeys``?array`NoArray of `FilesystemKeyData` objects for object storage. Each requires: `id` (string), `disk` (string), `isDefaultDisk` (bool). Pass `null` to detach all.`firewallRateLimitLevel``?string|FirewallRateLimitLevel`NoCloudflare rate limiting level. Pass `null` to disable.`firewallUnderAttackMode``bool`NoWhether Cloudflare's "Under Attack" mode is enabled.`databaseSchemaId``?string`NoThe database ID to attach. Pass `null` to detach.`cacheId``?string`NoThe cache ID to attach. Pass `null` to detach.`websocketApplicationId``?string`NoThe websocket application ID to attach. Pass `null` to detach.Response: `EnvironmentData`PropertyTypeDescription`id``string`The environment ID.`name``string`The environment name.`slug``string`The URL-friendly slug.`status``string|EnvironmentStatus`Current status: `deploying`, `running`, `hibernating`, `stopped`.`phpMajorVersion``string|PhpVersion`The PHP version: `8.2`, `8.3`, `8.4`, `8.5`.`nodeVersion``string|NodeVersion`The Node.js version: `20`, `22`, `24`.`vanityDomain``string`The free `laravel.cloud` subdomain.`createdFromAutomation``bool`Whether this environment was created by an automation.`usesOctane``bool`Whether Laravel Octane is enabled.`usesHibernation``bool`Whether hibernation is enabled.`usesPushToDeploy``bool`Whether push-to-deploy is enabled.`usesDeployHook``bool`Whether the deploy hook is enabled.`buildCommand``?string`The build command.`deployCommand``?string`The deploy command.`environmentVariables``EnvironmentVariableData[]`Array of environment variables. Each has `key` (string) and `value` (string).`networkSettings``NetworkSettingsData`Network configuration: `cacheStrategy` (string), `responseHeadersFrame` (string), `responseHeadersContentType` (string), `responseHeadersRobotsTag` (string), `responseHeadersHsts` (HstsData), `firewallRateLimitLevel` (?string), `firewallUnderAttackMode` (bool).`createdAt``?CarbonImmutable`When the environment was created.`application``?ApplicationData`The parent application.`branch``?BranchData`The Git branch. Has `id` and `name` properties.`deployments``DeploymentData[]`All deployments for this environment.`currentDeployment``?DeploymentData`The currently active deployment.`primaryDomain``?DomainData`The primary domain.`instances``InstanceData[]`All compute instances.`database``?DatabaseData`The attached database.`cache``?CacheData`The attached cache.`buckets``BucketData[]`Attached object storage buckets.`websocketApplication``?WebsocketApplicationData`The attached websocket application.Deployments
-----------

[](#deployments)

Deployments represent individual releases of your application. Each deployment captures a snapshot of your code at a specific commit, builds it, and rolls it out to the environment's instances.

### Listing Deployments

[](#listing-deployments)

```
$deployments = LaravelCloud::deployments($environmentId);
```

### Retrieving a Deployment

[](#retrieving-a-deployment)

```
$deployment = LaravelCloud::deployment($deploymentId);
```

### Creating a Deployment

[](#creating-a-deployment)

```
$deployment = LaravelCloud::deploy($environmentId);
```

### Deployment Logs

[](#deployment-logs)

Retrieve the build and deploy logs for a specific deployment:

```
$logs = LaravelCloud::deploymentLogs($deploymentId);

// Build phase
foreach ($logs->build->steps as $step) {
    echo "{$step->step}: {$step->status} ({$step->durationMs}ms)\n";
    echo $step->output;
}

// Deploy phase
foreach ($logs->deploy->steps as $step) {
    echo "{$step->step}: {$step->status}\n";
}
```

Response: `DeploymentData`PropertyTypeDescription`id``string`The deployment ID.`status``string|DeploymentStatus`Current status: `pending`, `build.running`, `build.succeeded`, `build.failed`, `deployment.running`, `deployment.succeeded`, `deployment.failed`, `cancelled`, `failed`.`branchName``?string`The Git branch that was deployed.`commitHash``?string`The commit SHA.`commitMessage``?string`The commit message.`commitAuthor``?string`The commit author.`failureReason``?string`Description of why the deployment failed.`phpMajorVersion``string|PhpVersion|null`The PHP version used: `8.2`, `8.3`, `8.4`, `8.5`.`buildCommand``?string`The build command used.`nodeVersion``string|NodeVersion|null`The Node.js version used: `20`, `22`, `24`.`usesOctane``bool`Whether Octane was enabled.`usesHibernation``bool`Whether hibernation was enabled.`startedAt``?CarbonImmutable`When the deployment started.`finishedAt``?CarbonImmutable`When the deployment finished.`createdAt``?CarbonImmutable`When the deployment was created.`environment``?EnvironmentData`The parent environment.`initiator``?UserData`The user who initiated the deployment. Has `id` and `name` properties.Instances
---------

[](#instances)

Instances are the compute infrastructure that runs your application code. Every environment has at least one **App** instance that serves HTTP traffic, and may optionally have **Worker** instances for background processing.

Instances come in two performance classes: **Flex** (lightweight, cost-efficient, supports hibernation) and **Pro** (larger sizes for sustained production workloads). Scaling can be disabled, set to custom min/max replicas, or left unlimited for automatic horizontal scaling.

### Listing Instances

[](#listing-instances)

```
$instances = LaravelCloud::instances($environmentId);
```

### Retrieving an Instance

[](#retrieving-an-instance)

```
$instance = LaravelCloud::instance($instanceId);
```

### Creating an Instance

[](#creating-an-instance)

```
use Redberry\LaravelCloudSdk\Enums\InstanceType;
use Redberry\LaravelCloudSdk\Enums\InstanceSize;
use Redberry\LaravelCloudSdk\Enums\InstanceScalingType;

$instance = LaravelCloud::createInstance($environmentId,
    name: 'web',
    type: InstanceType::App,
    size: InstanceSize::FlexG2vcpu1gb,
    scalingType: InstanceScalingType::Custom,
    maxReplicas: 5,
    minReplicas: 1,
);
```

### Updating an Instance

[](#updating-an-instance)

```
$instance = LaravelCloud::updateInstance($instanceId,
    size: InstanceSize::FlexM8vcpu8gb,
);
```

### Deleting an Instance

[](#deleting-an-instance)

```
LaravelCloud::deleteInstance($instanceId);
```

### Listing Available Instance Sizes

[](#listing-available-instance-sizes)

```
$sizes = LaravelCloud::instanceSizes();
```

Available parameters for `createInstance`ParameterTypeRequiredDescription`name``string`YesThe instance name (e.g., `web`, `worker`).`type``string|InstanceType`YesThe instance type: `app`, `service`, or `queue`.`size``string|InstanceSize`YesThe compute size (e.g., `FlexM2vcpu2gb`, `ProG2vcpu4gb`).`scalingType``string|InstanceScalingType`YesScaling strategy: `none`, `custom`, or `auto`.`maxReplicas``int`YesThe maximum number of replicas when using `custom` scaling.`minReplicas``int`YesThe minimum number of replicas when using `custom` scaling.`usesScheduler``bool`NoWhether this instance runs the task scheduler.`scalingCpuThresholdPercentage``?int`NoCPU usage percentage threshold that triggers scaling.`scalingMemoryThresholdPercentage``?int`NoMemory usage percentage threshold that triggers scaling.`backgroundProcesses``array`NoArray of `BackgroundProcessConfigData` objects. All fields are optional: `connection` (string), `queue` (string), `tries` (int), `backoff` (int), `sleep` (int), `rest` (int), `timeout` (int), `force` (bool).Available parameters for `updateInstance`ParameterTypeRequiredDescription`name``string`NoUpdate the instance name.`size``string|InstanceSize`NoChange the compute size.`scalingType``string|InstanceScalingType`NoChange the scaling strategy.`maxReplicas``int`NoUpdate maximum replicas.`minReplicas``int`NoUpdate minimum replicas.`usesSleepMode``bool`NoWhether the instance hibernates when idle (Flex only).`sleepTimeout``int`NoSeconds of inactivity before hibernation.`usesScheduler``bool`NoWhether this instance runs the task scheduler.`usesOctane``bool`NoWhether Laravel Octane is enabled.`usesInertiaSsr``bool`NoWhether Inertia SSR is enabled.`scalingCpuThresholdPercentage``?int`NoCPU threshold for scaling.`scalingMemoryThresholdPercentage``?int`NoMemory threshold for scaling.Response: `InstanceData`PropertyTypeDescription`id``string`The instance ID.`name``string`The instance name.`type``string|InstanceType``app`, `service`, or `queue`.`size``string|InstanceSize`The compute size (e.g., `flex-small`, `pro-medium`).`scalingType``string|InstanceScalingType``none`, `custom`, or `auto`.`minReplicas``int`Minimum number of replicas.`maxReplicas``int`Maximum number of replicas.`usesScheduler``bool`Whether the task scheduler runs on this instance.`scalingCpuThresholdPercentage``?int`CPU threshold for scaling.`scalingMemoryThresholdPercentage``?int`Memory threshold for scaling.`backgroundProcesses``BackgroundProcessData[]`Background processes attached to this instance.`createdAt``?CarbonImmutable`When the instance was created.`environment``?EnvironmentData`The parent environment.Response: `InstanceSizeData`PropertyTypeDescription`id``string`The size identifier (e.g., `flex-small`).`name``string`The size name.`label``string`Human-readable label.`description``string`Description of the size tier.`cpuType``string`The CPU architecture type.`computeClass``string`The compute class (e.g., `flex`, `pro`).`cpuCount``int`Number of CPU cores.`memoryMib``int`Memory in MiB.Background Processes
--------------------

[](#background-processes)

Background processes are long-running daemons attached to an instance - typically queue workers or custom commands. Each process defines a daemon type, the number of concurrent processes, and optionally a custom command or queue configuration.

### Listing Background Processes

[](#listing-background-processes)

```
$processes = LaravelCloud::backgroundProcesses($instanceId);
```

### Retrieving a Background Process

[](#retrieving-a-background-process)

```
$process = LaravelCloud::backgroundProcess($processId);
```

### Creating a Background Process

[](#creating-a-background-process)

```
use Redberry\LaravelCloudSdk\Enums\DaemonType;
use Redberry\LaravelCloudSdk\Data\BackgroundProcesses\BackgroundProcessConfigData;

// A queue worker
$process = LaravelCloud::createBackgroundProcess($instanceId,
    type: DaemonType::Worker,
    processes: 3,
    config: new BackgroundProcessConfigData(
        connection: 'redis',
        queue: 'default,emails',
        tries: 3,
        timeout: 60,
    ),
);

// A custom daemon
$process = LaravelCloud::createBackgroundProcess($instanceId,
    type: DaemonType::Custom,
    processes: 1,
    command: 'php artisan horizon',
);
```

### Updating a Background Process

[](#updating-a-background-process)

```
$process = LaravelCloud::updateBackgroundProcess($processId,
    processes: 5,
);
```

### Deleting a Background Process

[](#deleting-a-background-process)

```
LaravelCloud::deleteBackgroundProcess($processId);
```

Available parameters for `createBackgroundProcess`ParameterTypeRequiredDescription`type``string|DaemonType`YesThe daemon type: `worker` or `custom`.`processes``int`YesNumber of concurrent processes to run.`command``?string`NoThe command to execute (required for `custom` type).`config``?BackgroundProcessConfigData`NoQueue worker configuration (for `worker` type). All fields are optional: `connection` (string), `queue` (string), `tries` (int), `backoff` (int), `sleep` (int), `rest` (int), `timeout` (int), `force` (bool).Available parameters for `updateBackgroundProcess`ParameterTypeRequiredDescription`type``string|DaemonType`NoChange the daemon type: `worker` or `custom`.`processes``int`NoUpdate the number of concurrent processes.`command``?string`NoChange the command. Pass `null` to remove.`config``?BackgroundProcessConfigData`NoUpdate queue worker configuration. All fields are optional: `connection` (string), `queue` (string), `tries` (int), `backoff` (int), `sleep` (int), `rest` (int), `timeout` (int), `force` (bool).Response: `BackgroundProcessData`PropertyTypeDescription`id``string`The process ID.`type``string|DaemonType``worker` or `custom`.`processes``int`Number of concurrent processes.`command``?string`The custom command, if applicable.`config``?BackgroundProcessConfigData`Queue worker configuration.`strategyType``string|DaemonStrategyType`Scaling strategy: `none`, `growth_rate`, or `queue_size`.`strategyThreshold``?int`The threshold for the scaling strategy.`createdAt``?CarbonImmutable`When the process was created.`instance``?InstanceData`The parent instance.Commands
--------

[](#commands)

Commands let you execute one-off Artisan or shell commands against a running environment - useful for migrations, cache clearing, or debugging.

### Listing Commands

[](#listing-commands)

```
$commands = LaravelCloud::commands($environmentId);
```

### Retrieving a Command

[](#retrieving-a-command)

```
$command = LaravelCloud::command($commandId);
```

### Running a Command

[](#running-a-command)

```
$command = LaravelCloud::runCommand($environmentId, command: 'php artisan migrate --force');
```

Response: `CommandData`PropertyTypeDescription`id``string`The command ID.`command``string`The command that was executed.`output``?string`The command output.`status``string|CommandStatus`Current status: `pending`, `command.created`, `command.running`, `command.success`, `command.failure`.`exitCode``?int`The process exit code.`failureReason``?string`Description of why the command failed.`startedAt``?CarbonImmutable`When the command started executing.`finishedAt``?CarbonImmutable`When the command finished.`createdAt``?CarbonImmutable`When the command was created.`environment``?EnvironmentData`The parent environment.`deployment``?DeploymentData`The associated deployment.`initiator``?UserData`The user who ran the command. Has `id` and `name` properties.Domains
-------

[](#domains)

Every environment receives a free `laravel.cloud` subdomain after its first deployment. For production, you can attach custom domains with automatic SSL provisioning and renewal.

Custom domains support root domains, www variants, and wildcards. Domain verification can happen in real-time (point DNS first) or via pre-verification (verify ownership before switching traffic).

### Listing Domains

[](#listing-domains)

```
$domains = LaravelCloud::domains($environmentId);
```

### Retrieving a Domain

[](#retrieving-a-domain)

```
$domain = LaravelCloud::domain($domainId);
```

### Creating a Domain

[](#creating-a-domain)

```
use Redberry\LaravelCloudSdk\Enums\DomainRedirect;
use Redberry\LaravelCloudSdk\Enums\DomainVerificationMethod;

$domain = LaravelCloud::createDomain($environmentId,
    name: 'example.com',
    wwwRedirect: DomainRedirect::WwwToRoot,
    verificationMethod: DomainVerificationMethod::RealTime,
);
```

Available parameters for `createDomain`ParameterTypeRequiredDescription`name``string`YesThe domain name (e.g., `example.com`).`wwwRedirect``string|DomainRedirect`YesRedirect behavior: `DomainRedirect::RootToWww` or `DomainRedirect::WwwToRoot`.`verificationMethod``string|DomainVerificationMethod`YesVerification: `DomainVerificationMethod::RealTime` or `DomainVerificationMethod::PreVerification`.`cloudflareStrategy``string|DomainCloudflareStrategy`NoOnly needed if your domain is already proxied through Cloudflare.`wildcardEnabled``?bool`NoWhether to enable wildcard subdomains.`allowDowntime``?bool`NoWhether a brief interruption is acceptable during DNS switchover.### Updating a Domain

[](#updating-a-domain)

```
$domain = LaravelCloud::updateDomain($domainId,
    verificationMethod: DomainVerificationMethod::PreVerification,
);
```

Available parameters for `updateDomain`ParameterTypeRequiredDescription`verificationMethod``string|DomainVerificationMethod`Yes`DomainVerificationMethod::RealTime` or `DomainVerificationMethod::PreVerification`.### Verifying a Domain

[](#verifying-a-domain)

```
$domain = LaravelCloud::verifyDomain($domainId);
```

### Deleting a Domain

[](#deleting-a-domain)

```
LaravelCloud::deleteDomain($domainId);
```

Response: `DomainData`PropertyTypeDescription`id``string`The domain ID.`name``string`The domain name.`type``string|DomainType``root`, `www`, or `wildcard`.`hostnameStatus``string|DomainStatus`Hostname verification status: `pending`, `verified`, `failed`, `disabled`.`sslStatus``string|DomainStatus`SSL certificate status: `pending`, `verified`, `failed`, `disabled`.`originStatus``string|DomainStatus`Origin routing status: `pending`, `verified`, `failed`, `disabled`.`redirect``string|DomainRedirect|null`The redirect behavior: `root_to_www` or `www_to_root`, if configured.`cloudflareStrategy``string|DomainCloudflareStrategy|null`The Cloudflare strategy: `none`, `dns`, or `dns_proxy`, if applicable.`downtime``?bool`Whether downtime was allowed during setup.`wildcardEnabled``bool`Whether wildcard subdomains are enabled.`actionRequired``?string`Description of any action needed from the user.`dnsRecords``array`DNS records that need to be configured.`lastVerifiedAt``?CarbonImmutable`When the domain was last verified.`createdAt``?CarbonImmutable`When the domain was created.`environment``?EnvironmentData`The parent environment.Database Clusters
-----------------

[](#database-clusters)

A database cluster is the managed infrastructure that hosts one or more logical databases. You create a cluster once, then create individual databases within it for each environment.

This is one of the most important cost-optimization concepts in Laravel Cloud: **non-production environments can share a single database cluster** by each having their own database within it, while production typically would get a dedicated cluster.

Laravel Cloud supports **Laravel MySQL** (managed MySQL 8.0/8.4) and **Neon Serverless Postgres** (serverless PostgreSQL 16/17/18). **AWS RDS** (MySQL 8 or PostgreSQL 18) is also available for [Laravel Private Cloud](https://cloud.laravel.com) customers.

### Listing Database Clusters

[](#listing-database-clusters)

```
$clusters = LaravelCloud::databaseClusters();
```

### Retrieving a Database Cluster

[](#retrieving-a-database-cluster)

```
$cluster = LaravelCloud::databaseCluster($clusterId);
```

### Creating a Database Cluster

[](#creating-a-database-cluster)

```
use Redberry\LaravelCloudSdk\Enums\DatabaseType;
use Redberry\LaravelCloudSdk\Enums\DatabaseClusterSize;
use Redberry\LaravelCloudSdk\Data\DatabaseClusters\LaravelMysqlConfigData;

$cluster = LaravelCloud::createDatabaseCluster(
    name: 'production-db',
    type: DatabaseType::LaravelMysql84,
    region: CloudRegion::UsEast1,
    config: new LaravelMysqlConfigData(
        size: DatabaseClusterSize::Flex1vcpu1gb,
        storage: 10,
        isPublic: false,
        usesScheduledSnapshots: true,
        retentionDays: 7,
        maintenanceWindow: null,
    ),
);
```

### Updating a Database Cluster

[](#updating-a-database-cluster)

```
$cluster = LaravelCloud::updateDatabaseCluster($clusterId,
    config: new LaravelMysqlConfigData(
        size: DatabaseClusterSize::Flex1vcpu2gb,
        storage: 20,
        isPublic: false,
        usesScheduledSnapshots: true,
        retentionDays: 14,
        maintenanceWindow: null,
    ),
);
```

### Deleting a Database Cluster

[](#deleting-a-database-cluster)

```
LaravelCloud::deleteDatabaseCluster($clusterId);
```

### Database Cluster Metrics

[](#database-cluster-metrics)

Metrics accept the same `MetricPeriod` options as [environment metrics](#environment-metrics):

```
$metrics = LaravelCloud::databaseClusterMetrics($clusterId);
$metrics = LaravelCloud::databaseClusterMetrics($clusterId, period: MetricPeriod::SevenDays);
```

### Listing Available Database Types

[](#listing-available-database-types)

```
$types = LaravelCloud::databaseTypes();
```

Available parameters for `createDatabaseCluster`ParameterTypeRequiredDescription`name``string`YesThe cluster name.`type``string|DatabaseType`YesThe database engine. Use `databaseTypes()` to list all options.`region``string|CloudRegion`YesThe region. Must match attached environments.`config``NeonServerlessPostgresConfigData|LaravelMysqlConfigData|AwsRdsConfigData`YesEngine-specific configuration object. Must match the selected `type`. See below.`clusterId``?int`NoOptional cluster placement hint.**`LaravelMysqlConfigData`** - `size` (string|DatabaseClusterSize, required), `storage` (int, required), `isPublic` (bool, required), `usesScheduledSnapshots` (bool, required), `retentionDays` (int, required), `maintenanceWindow` (?string).

**`NeonServerlessPostgresConfigData`** - `cuMin` (float|NeonServerlessPostgresComputeUnit, required), `cuMax` (float|NeonServerlessPostgresComputeUnit, required), `suspendSeconds` (int, required), `retentionDays` (int, required).

**`AwsRdsConfigData`** - `size` (string|DatabaseClusterSize, required), `storage` (int, required), `isPublic` (bool, required), `usesPitr` (bool, required), `retentionDays` (int, required), `deploymentOption` (string|DeploymentOption, required), `maintenanceWindow` (?string), `readReplicas` (?int).

Available parameters for `updateDatabaseCluster`ParameterTypeRequiredDescription`config``NeonServerlessPostgresConfigData|LaravelMysqlConfigData|AwsRdsConfigData`YesEngine-specific configuration. Must match the cluster's database type. See [createDatabaseCluster](#creating-a-database-cluster) for config field details.Response: `DatabaseClusterData`PropertyTypeDescription`id``string`The cluster ID.`name``string`The cluster name.`type``string|DatabaseType`The database engine: `laravel_mysql_84`, `laravel_mysql_8`, `aws_rds_mysql_8`, `aws_rds_postgres_18`, `neon_serverless_postgres_18`, `neon_serverless_postgres_17`, `neon_serverless_postgres_16`.`status``string|DatabaseStatus`Current status: `creating`, `updating`, `available`, `restoring`, `restore_failed`, `archiving`, `archived`, `deleting`, `deleted`, etc.`region``string|CloudRegion`The region.`config``NeonServerlessPostgresConfigData|LaravelMysqlConfigData|AwsRdsConfigData`Engine-specific configuration. See [createDatabaseCluster](#creating-a-database-cluster) for field details.`connection``DatabaseConnectionData`Connection details: `hostname` (string), `port` (int), `protocol` (string|DatabaseProtocol: `mysql` or `postgres`), `driver` (string|DatabaseDriver: `mysql` or `pgsql`), `username` (string), `password` (string).`createdAt``?CarbonImmutable`When the cluster was created.`databases``DatabaseData[]`All databases within this cluster.Database Snapshots
------------------

[](#database-snapshots)

Snapshots provide point-in-time backups of your database cluster. You can create manual snapshots, list existing ones, and restore a cluster from a snapshot or a specific point in time.

### Creating a Snapshot

[](#creating-a-snapshot)

```
$snapshot = LaravelCloud::createDatabaseSnapshot($clusterId,
    name: 'pre-migration-backup',
    description: 'Before running v2 migrations',
);
```

### Listing Snapshots

[](#listing-snapshots)

```
$snapshots = LaravelCloud::databaseSnapshots($clusterId);
```

### Retrieving a Snapshot

[](#retrieving-a-snapshot)

```
$snapshot = LaravelCloud::databaseSnapshot($snapshotId);
```

### Restoring From a Snapshot

[](#restoring-from-a-snapshot)

Restoring creates a **new** database cluster from the snapshot data:

```
// Restore from a specific snapshot
$cluster = LaravelCloud::restoreDatabaseCluster($clusterId,
    name: 'restored-cluster',
    databaseSnapshotId: $snapshotId,
);

// Restore to a specific point in time
$cluster = LaravelCloud::restoreDatabaseCluster($clusterId,
    name: 'restored-cluster',
    restoreTime: '2025-06-15T14:30:00Z',
);
```

### Deleting a Snapshot

[](#deleting-a-snapshot)

```
LaravelCloud::deleteDatabaseSnapshot($snapshotId);
```

Available parameters for `createDatabaseSnapshot`ParameterTypeRequiredDescription`name``string`YesThe snapshot name.`description``?string`NoAn optional description for the snapshot.Available parameters for `restoreDatabaseCluster`ParameterTypeRequiredDescription`name``string`YesThe name for the new cluster created from the restore.`restoreTime``?string`NoISO 8601 timestamp for point-in-time restore. Mutually exclusive with `databaseSnapshotId`.`databaseSnapshotId``?string`NoThe snapshot ID to restore from. Mutually exclusive with `restoreTime`.Response: `DatabaseSnapshotData`PropertyTypeDescription`id``string`The snapshot ID.`name``string`The snapshot name.`description``?string`The snapshot description.`type``string|DatabaseSnapshotType``manual` or `scheduled`.`status``string|DatabaseSnapshotStatus`Current status: `pending`, `creating`, `available`, `failed`, `deleting`.`storageBytes``?int`The snapshot size in bytes.`pitrEnabled``?bool`Whether point-in-time recovery is enabled.`pitrEndsAt``?CarbonImmutable`When the PITR window expires.`completedAt``?CarbonImmutable`When the snapshot completed.`createdAt``?CarbonImmutable`When the snapshot was created.`databaseCluster``?DatabaseClusterData`The parent database cluster.Databases
---------

[](#databases)

Databases are the logical schemas within a [database cluster](#database-clusters). When you attach a database to an environment, Laravel Cloud automatically injects the connection credentials. This separation allows you to share one cluster across dev, staging, and UAT environments - each with their own isolated database.

### Listing Databases

[](#listing-databases)

```
$databases = LaravelCloud::databases($clusterId);
```

### Retrieving a Database

[](#retrieving-a-database)

```
$database = LaravelCloud::database($clusterId, $databaseId);
```

### Creating a Database

[](#creating-a-database)

```
$database = LaravelCloud::createDatabase($clusterId,
    name: 'my_database',
);
```

### Deleting a Database

[](#deleting-a-database)

```
LaravelCloud::deleteDatabase($clusterId, $databaseId);
```

Response: `DatabaseData`PropertyTypeDescription`id``string`The database ID.`name``string`The database name.`createdAt``?CarbonImmutable`When the database was created.`databaseCluster``?DatabaseClusterData`The parent database cluster.`environments``EnvironmentData[]`Environments attached to this database.Caches
------

[](#caches)

Caches are managed Redis-compatible stores that serve as your application's cache, queue backend, or session store. Caches can be shared across environments - each receives a unique prefix to prevent collisions.

Two types are available: **Laravel Valkey** (managed, Redis-compatible) and **Upstash Redis** (serverless). When attached to an environment, Laravel Cloud injects `CACHE_STORE`, `REDIS_HOST`, and `REDIS_PASSWORD` automatically.

### Listing Caches

[](#listing-caches)

```
$caches = LaravelCloud::caches();
```

### Retrieving a Cache

[](#retrieving-a-cache)

```
$cache = LaravelCloud::cache($cacheId);
```

### Creating a Cache

[](#creating-a-cache)

```
use Redberry\LaravelCloudSdk\Enums\CacheType;
use Redberry\LaravelCloudSdk\Enums\CacheSize;

$cache = LaravelCloud::createCache(
    type: CacheType::LaravelValkey,
    name: 'production-cache',
    region: CloudRegion::UsEast1,
    size: CacheSize::Flex256mb,
    autoUpgradeEnabled: true,
    isPublic: false,
);
```

### Updating a Cache

[](#updating-a-cache)

```
$cache = LaravelCloud::updateCache($cacheId,
    size: CacheSize::Flex512mb,
);
```

### Deleting a Cache

[](#deleting-a-cache)

```
LaravelCloud::deleteCache($cacheId);
```

### Cache Metrics

[](#cache-metrics)

Metrics accept the same `MetricPeriod` options as [environment metrics](#environment-metrics):

```
$metrics = LaravelCloud::cacheMetrics($cacheId);
$metrics = LaravelCloud::cacheMetrics($cacheId, period: MetricPeriod::TwentyFourHours);
```

### Listing Available Cache Types

[](#listing-available-cache-types)

```
$types = LaravelCloud::cacheTypes();
```

Available parameters for `createCache`ParameterTypeRequiredDescription`type``string|CacheType`YesThe cache engine: `laravel_valkey` or `upstash_redis`.`name``string`YesThe cache instance name.`region``string|CloudRegion`YesThe region. Must match attached environments.`size``string|CacheSize`YesThe storage size. Use `cacheTypes()` to see options.`autoUpgradeEnabled``bool`YesWhether the cache automatically upgrades in size when needed.`isPublic``bool`YesWhether the cache is accessible from the open internet outside the Laravel Cloud network.`evictionPolicy``?string|EvictionPolicy`NoKey eviction policy (Laravel Valkey only).Available parameters for `updateCache`ParameterTypeRequiredDescription`name``string`NoUpdate the cache name.`size``string|CacheSize`NoChange the storage size.`autoUpgradeEnabled``bool`NoToggle automatic size upgrades.`isPublic``bool`NoToggle public internet access.`evictionPolicy``?string|EvictionPolicy`NoChange the eviction policy.Response: `CacheData`PropertyTypeDescription`id``string`The cache ID.`name``string`The cache name.`type``string|CacheType``laravel_valkey` or `upstash_redis`.`status``string|CacheStatus`Current status: `creating`, `updating`, `available`, `deleting`, `deleted`.`region``string|CloudRegion`The region.`size``string|CacheSize`The storage size. Upstash: `250mb`, `1gb`, `2.5gb`, `5gb`, `12gb`, `50gb`, `100gb`, `500gb`. Valkey Pro: `valkey-pro.250mb`, `valkey-pro.1gb`, `valkey-pro.2.5gb`, `valkey-pro.5gb`, `valkey-pro.12gb`, `valkey-pro.25gb`, `valkey-pro.50gb`.`autoUpgradeEnabled``bool`Whether automatic size upgrades are enabled.`isPublic``bool`Whether the cache is publicly accessible.`connection``CacheConnectionData`Connection details: `hostname` (?string), `port` (?int), `protocol` (string|CacheProtocol: `redis`), `username` (?string), `password` (?string).`createdAt``?CarbonImmutable`When the cache was created.Object Storage Buckets
----------------------

[](#object-storage-buckets)

Buckets provide S3-compatible file storage powered by Cloudflare R2, integrated directly with Laravel's `Storage` facade. When a bucket is attached to an environment, Laravel Cloud injects the necessary AWS S3-compatible credentials and `FILESYSTEM_DISK` configuration automatically.

Buckets can be **private** (files are inaccessible to the public, though you can generate temporary URLs via `Storage::temporaryUrl`) or **public** (files are accessible via internet-facing URLs). You may also choose a **jurisdiction** (`default` or `eu`) for data residency compliance.

A common pattern is to create **one private bucket** for user uploads and sensitive files, and **one public bucket** for assets that need to be served directly. Non-production environments can share a single bucket with different [keys](#bucket-keys) for access isolation - each key provides scoped credentials, so staging and QA can use the same bucket without interfering with each other.

### Listing Buckets

[](#listing-buckets)

```
$buckets = LaravelCloud::buckets();
```

### Retrieving a Bucket

[](#retrieving-a-bucket)

```
$bucket = LaravelCloud::bucket($bucketId);
```

### Creating a Bucket

[](#creating-a-bucket)

```
use Redberry\LaravelCloudSdk\Enums\BucketVisibility;
use Redberry\LaravelCloudSdk\Enums\BucketJurisdiction;
use Redberry\LaravelCloudSdk\Enums\KeyPermission;

$bucket = LaravelCloud::createBucket(
    name: 'media-storage',
    visibility: BucketVisibility::Private,
    jurisdiction: BucketJurisdiction::Eu,
    keyName: 'default-key',
    keyPermission: KeyPermission::ReadWrite,
);
```

### Updating a Bucket

[](#updating-a-bucket)

```
$bucket = LaravelCloud::updateBucket($bucketId,
    name: 'new-bucket-name',
);
```

### Deleting a Bucket

[](#deleting-a-bucket)

```
LaravelCloud::deleteBucket($bucketId);
```

Available parameters for `createBucket`ParameterTypeRequiredDescription`name``string`YesThe bucket name.`visibility``string|BucketVisibility`Yes`private` or `public`.`jurisdiction``string|BucketJurisdiction`Yes`default` (global) or `eu` (EU-only).`keyName``string`YesName for the initial access key.`keyPermission``string|KeyPermission`Yes`read_write` or `read_only`.`allowedOrigins``?array`NoCORS allowed origins.Available parameters for `updateBucket`ParameterTypeRequiredDescription`name``string`NoUpdate the bucket name.`visibility``string|BucketVisibility`NoChange visibility: `private` or `public`.`allowedOrigins``?array`NoUpdate CORS allowed origins. Pass `null` to remove.Response: `BucketData`PropertyTypeDescription`id``string`The bucket ID.`name``string`The bucket name.`type``string|BucketType`The storage backend (e.g., `cloudflare_r2`).`status``string|BucketStatus`Current status: `creating`, `updating`, `available`, `deleting`, `deleted`.`visibility``string|BucketVisibility``private` or `public`.`jurisdiction``string|BucketJurisdiction``default` or `eu`.`endpoint``?string`The S3-compatible endpoint URL.`url``?string`The public URL for public buckets.`allowedOrigins``?array`CORS allowed origins.`createdAt``?CarbonImmutable`When the bucket was created.`keys``BucketKeyData[]`All access keys for this bucket.Bucket Keys
-----------

[](#bucket-keys)

Bucket keys are scoped credentials that control access to a specific bucket. Each key has a permission level - **read-write** or **read-only**. You can create multiple keys with different permissions to control access granularity - for example, giving your application full read-write access while providing a reporting service with read-only credentials.

### Listing Bucket Keys

[](#listing-bucket-keys)

```
$keys = LaravelCloud::bucketKeys($bucketId);
```

### Retrieving a Bucket Key

[](#retrieving-a-bucket-key)

```
$key = LaravelCloud::bucketKey($keyId);
```

### Creating a Bucket Key

[](#creating-a-bucket-key)

```
$key = LaravelCloud::createBucketKey($bucketId,
    name: 'upload-key',
    permission: KeyPermission::ReadWrite,
);
```

### Updating a Bucket Key

[](#updating-a-bucket-key)

```
$key = LaravelCloud::updateBucketKey($keyId, name: 'new-key-name');
```

### Deleting a Bucket Key

[](#deleting-a-bucket-key)

```
LaravelCloud::deleteBucketKey($keyId);
```

Response: `BucketKeyData`PropertyTypeDescription`id``string`The key ID.`name``string`The key name.`permission``string|KeyPermission``read_write` or `read_only`.`accessKeyId``?string`The S3-compatible access key ID. Only returned on creation.`accessKeySecret``?string`The S3-compatible secret key. Only returned on creation.`createdAt``?CarbonImmutable`When the key was created.`bucket``?BucketData`The parent bucket.Websocket Clusters
------------------

[](#websocket-clusters)

Websocket clusters provide fully managed WebSocket infrastructure powered by [Laravel Reverb](https://reverb.laravel.com). Each cluster is created in a specific region with a maximum concurrent connection capacity that is shared across its websocket applications. When a websocket application is attached to an environment, Laravel Cloud automatically injects the necessary Reverb connection credentials.

### Listing Websocket Clusters

[](#listing-websocket-clusters)

```
$clusters = LaravelCloud::websocketClusters();
```

### Retrieving a Websocket Cluster

[](#retrieving-a-websocket-cluster)

```
$cluster = LaravelCloud::websocketCluster($clusterId);
```

### Creating a Websocket Cluster

[](#creating-a-websocket-cluster)

```
use Redberry\LaravelCloudSdk\Enums\WebsocketServerType;
use Redberry\LaravelCloudSdk\Enums\WebsocketMaxConnections;

$cluster = LaravelCloud::createWebsocketCluster(
    name: 'production-ws',
    type: WebsocketServerType::Reverb,
    region: CloudRegion::UsEast1,
    maxConnections: WebsocketMaxConnections::V500,
);
```

### Updating a Websocket Cluster

[](#updating-a-websocket-cluster)

```
$cluster = LaravelCloud::updateWebsocketCluster($clusterId,
    maxConnections: WebsocketMaxConnections::V2000,
);
```

### Deleting a Websocket Cluster

[](#deleting-a-websocket-cluster)

```
LaravelCloud::deleteWebsocketCluster($clusterId);
```

### Websocket Cluster Metrics

[](#websocket-cluster-metrics)

Metrics accept the same `MetricPeriod` options as [environment metrics](#environment-metrics):

```
$metrics = LaravelCloud::websocketClusterMetrics($clusterId);
$metrics = LaravelCloud::websocketClusterMetrics($clusterId, period: MetricPeriod::TwentyFourHours);
```

Available parameters for `createWebsocketCluster`ParameterTypeRequiredDescription`name``string`YesThe cluster name.`type``string|WebsocketServerType`YesCurrently only `reverb`.`region``string|CloudRegion`YesThe region.`maxConnections``string|WebsocketMaxConnections`YesMaximum concurrent connections: `100`, `200`, `500`, `2000`, `5000`, or `10000`.Available parameters for `updateWebsocketCluster`ParameterTypeRequiredDescription`name``string`NoUpdate the cluster name.`maxConnections``string|WebsocketMaxConnections`NoChange the maximum concurrent connections.Response: `WebsocketClusterData`PropertyTypeDescription`id``string`The cluster ID.`name``string`The cluster name.`type``string|WebsocketServerType`The server type: `reverb`.`region``string|CloudRegion`The region.`status``string|WebsocketStatus`Current status: `creating`, `updating`, `available`, `deleting`, `deleted`.`maxConnections``string|WebsocketMaxConnections`Maximum concurrent connections: `100`, `200`, `500`, `2000`, `5000`, or `10000`.`connectionDistributionStrategy``string|WebsocketConnectionDistributionStrategy`How connections are distributed: `evenly` or `custom`.`hostname``string`The WebSocket server hostname for client connections.`createdAt``?CarbonImmutable`When the cluster was created.`applications``WebsocketApplicationData[]`All applications within this cluster.Websocket Applications
----------------------

[](#websocket-applications)

Websocket applications are logical partitions within a websocket cluster. Each cluster creates a default `main` application on provisioning. Additional applications distribute the cluster's connection capacity across different projects.

### Listing Websocket Applications

[](#listing-websocket-applications)

```
$applications = LaravelCloud::websocketApplications($clusterId);
```

### Retrieving a Websocket Application

[](#retrieving-a-websocket-application)

```
$application = LaravelCloud::websocketApplication($applicationId);
```

### Creating a Websocket Application

[](#creating-a-websocket-application)

```
$application = LaravelCloud::createWebsocketApplication($clusterId,
    name: 'my-ws-app',
);
```

### Updating a Websocket Application

[](#updating-a-websocket-application)

```
$application = LaravelCloud::updateWebsocketApplication($applicationId,
    name: 'new-ws-app-name',
);
```

### Deleting a Websocket Application

[](#deleting-a-websocket-application)

```
LaravelCloud::deleteWebsocketApplication($applicationId);
```

### Websocket Application Metrics

[](#websocket-application-metrics)

Metrics accept the same `MetricPeriod` options as [environment metrics](#environment-metrics):

```
$metrics = LaravelCloud::websocketApplicationMetrics($applicationId);
$metrics = LaravelCloud::websocketApplicationMetrics($applicationId, period: MetricPeriod::SevenDays);
```

Available parameters for `createWebsocketApplication`ParameterTypeRequiredDescription`name``string`YesThe application name.`pingInterval``int`NoSeconds between keep-alive pings.`activityTimeout``int`NoSeconds of inactivity before a connection is stale.`allowedOrigins``?array`NoAllowed WebSocket origins. Pass `null` for all.Available parameters for `updateWebsocketApplication`ParameterTypeRequiredDescription`name``string`NoUpdate the application name.`pingInterval``int`NoChange seconds between keep-alive pings.`activityTimeout``int`NoChange seconds of inactivity before a connection is stale.`allowedOrigins``?array`NoUpdate allowed origins. Pass `null` for all.Response: `WebsocketApplicationData`PropertyTypeDescription`id``string`The websocket application ID.`name``string`The application name.`appId``string`The Reverb application ID for client-side configuration.`allowedOrigins``array`Allowed WebSocket origins.`pingInterval``int`Seconds between keep-alive pings.`activityTimeout``int`Seconds of inactivity before a connection is stale.`maxMessageSize``int`Maximum message size in bytes.`maxConnections``int`Maximum concurrent connections for this application.`key``string`The Reverb app key for client-side configuration.`secret``string`The Reverb app secret for server-side verification.`createdAt``?CarbonImmutable`When the application was created.`websocketCluster``?WebsocketClusterData`The parent websocket cluster.Dedicated Clusters
------------------

[](#dedicated-clusters)

Dedicated clusters provide isolated compute infrastructure for your resources. You may filter by region, resource type, or status:

```
use Redberry\LaravelCloudSdk\Enums\ClusterType;
use Redberry\LaravelCloudSdk\Enums\ClusterStatus;

// List all dedicated clusters
$clusters = LaravelCloud::dedicatedClusters();

// Filter by type and region
$clusters = LaravelCloud::dedicatedClusters(
    region: CloudRegion::UsEast1,
    type: ClusterType::Applications,
    status: ClusterStatus::Active,
);
```

Available cluster types: `Applications`, `MysqlDatabases`, `RdsDatabases`, `RedisCaches`, `ReverbWebsocketServers`.

Response: `DedicatedClusterData`PropertyTypeDescription`id``string`The cluster ID.`name``string`The cluster name.`region``string|CloudRegion`The region.`type``string|ClusterType`The resource type: `applications`, `mysql-databases`, `rds-databases`, `redis-caches`, or `reverb-websocket-servers`.`tenancyType``string|TenancyType``shared` or `dedicated`.`status``string|ClusterStatus`Current status: `draft`, `active`, `maintenance`, or `inactive`.`createdAt``?CarbonImmutable`When the cluster was created.Organization
------------

[](#organization)

Retrieve the organization associated with the current API token:

```
$org = LaravelCloud::organization();

$org->id;   // "org-abc123"
$org->name; // "My Team"
$org->slug; // "my-team"
```

Response: `OrganizationData`PropertyTypeDescription`id``string`The organization ID.`name``string`The organization name.`slug``string`The URL-friendly slug.Regions
-------

[](#regions)

Regions determine where your infrastructure is physically located. For optimal performance, your application and all its resources should be in the same region.

```
$regions = LaravelCloud::regions();
```

Response: `RegionData`PropertyTypeDescription`region``string|CloudRegion`The region identifier.`label``string`Human-readable region name.`flag``string`The flag emoji for the region's country.IP Addresses
------------

[](#ip-addresses)

Retrieve the IP addresses used by Laravel Cloud, optionally filtered by region. This is useful for configuring firewall allowlists on external services:

```
// All regions
$addresses = LaravelCloud::ipAddresses();

// Specific region
$addresses = LaravelCloud::ipAddresses(region: CloudRegion::UsEast1);
```

Response: `IpAddressData`PropertyTypeDescription`region``string|CloudRegion`The region these addresses belong to.`ipv4``array`List of IPv4 addresses.`ipv6``array`List of IPv6 addresses.Error Handling
--------------

[](#error-handling)

The SDK throws specific exceptions for common API errors:

```
use Redberry\LaravelCloudSdk\Exceptions\ValidationException;
use Redberry\LaravelCloudSdk\Exceptions\RateLimitException;
use Redberry\LaravelCloudSdk\Exceptions\HtmlResponseException;

try {
    LaravelCloud::createApplication(...);
} catch (ValidationException $e) {
    // Invalid request data (422)
    $errors = $e->errors();
} catch (RateLimitException $e) {
    // Too many requests (429)
    $retryAfter = $e->retryAfter();
}
```

All other HTTP errors (401, 404, 500, etc.) throw Saloon's default `RequestException`, which you may catch for general error handling:

```
use Saloon\Exceptions\Request\RequestException;

try {
    $app = LaravelCloud::application('app-nonexistent');
} catch (RequestException $e) {
    $e->getResponse()->status(); // 404
}
```

The SDK also detects unexpected HTML responses from the API (which can occur during maintenance or when an endpoint URL is incorrect) and throws an `HtmlResponseException` with a descriptive message instead of failing silently or returning unparseable data.

Testing
-------

[](#testing)

The SDK is built on [Saloon](https://docs.saloon.dev), which provides a built-in mechanism for faking HTTP requests during tests. You should use Saloon's `MockResponse` to prevent real API calls and assert that the correct requests are being sent.

### Faking Responses

[](#faking-responses)

The Laravel Cloud API follows the [JSON:API](https://jsonapi.org) specification. Each resource is returned with an `id`, `type`, and `attributes` object inside `data`. Related resources are sideloaded in a top-level `included` array and linked via the `relationships` object.

The SDK handles all of this automatically - you just need to structure your mock responses to match. Here's a basic example without relationships:

```
use Redberry\LaravelCloudSdk\Requests\Applications\ListApplicationsRequest;
use Saloon\Laravel\Facades\Saloon;
use Saloon\Http\Faking\MockResponse;

Saloon::fake([
    ListApplicationsRequest::class => MockResponse::make([
        'data' => [
            [
                'id' => 'app-123',
                'type' => 'applications',
                'attributes' => [
                    'name' => 'my-app',
                    'slug' => 'my-app',
                    'region' => 'us-east-1',
                    'slack_channel' => null,
                    'avatar_url' => null,
                    'repository' => null,
                    'created_at' => '2025-01-01T00:00:00Z',
                ],
            ],
        ],
        'included' => [],
    ], 200),
]);

$applications = LaravelCloud::applications();

expect($applications)->toHaveCount(1);
expect($applications->first()->name)->toBe('my-app');
expect($applications->first()->organization)->toBeNull(); // no included data

Saloon::assertSent(ListApplicationsRequest::class);
```

### Faking Responses with Relationships

[](#faking-responses-with-relationships)

To test relationship hydration, add a `relationships` object to each resource in `data` and provide the related resources in the `included` array. The SDK will automatically match them by `type` and `id`:

```
use Redberry\LaravelCloudSdk\Requests\Applications\GetApplicationRequest;
use Saloon\Laravel\Facades\Saloon;
use Saloon\Http\Faking\MockResponse;

Saloon::fake([
    GetApplicationRequest::class => MockResponse::make([
        'data' => [
            'id' => 'app-123',
            'type' => 'applications',
            'attributes' => [
                'name' => 'my-app',
                'slug' => 'my-app',
                'region' => 'us-east-1',
                'slack_channel' => null,
                'avatar_url' => null,
                'repository' => null,
                'created_at' => '2025-01-01T00:00:00Z',
            ],
            'relationships' => [
                'organization' => [
                    'data' => ['type' => 'organizations', 'id' => 'org-456'],
                ],
                'environments' => [
                    'data' => [
                        ['type' => 'environments', 'id' => 'env-789'],
                    ],
                ],
            ],
        ],
        'included' => [
            [
                'id' => 'org-456',
                'type' => 'organizations',
                'attributes' => [
                    'name' => 'My Team',
                    'slug' => 'my-team',
                ],
            ],
            [
                'id' => 'env-789',
                'type' => 'environments',
                'attributes' => [
                    'name' => 'production',
                    'slug' => 'production',
                    'status' => 'running',
                    // ... other attributes
                ],
            ],
        ],
    ], 200),
]);

$app = LaravelCloud::application('app-123');

expect($app->name)->toBe('my-app');
expect($app->organization->name)->toBe('My Team');
expect($app->environments)->toHaveCount(1);
expect($app->environments[0]->name)->toBe('production');
```

### Preventing Stray Requests

[](#preventing-stray-requests)

To ensure no real API calls leak through during your test suite, you may call `preventStrayRequests`. Any unfaked request will throw an exception:

```
// In your Pest.php
Saloon::preventStrayRequests();
```

### Faking Error Responses

[](#faking-error-responses)

```
use Saloon\Exceptions\Request\RequestException;
use Redberry\LaravelCloudSdk\Requests\Applications\GetApplicationRequest;

Saloon::fake([
    GetApplicationRequest::class => MockResponse::make([], 404),
]);

LaravelCloud::application('app-nonexistent'); // throws RequestException
```

For more details on request faking, assertions, and recording, refer to the [Saloon testing documentation](https://docs.saloon.dev).

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Gaga Darsalia](https://github.com/rayredberry)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance89

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Total

2

Last Release

86d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2ceddc163a8c821d012238fe8f5439bd018bcd3036368c373eb397a19acfe7b?d=identicon)[Redberry LTD](/maintainers/Redberry%20LTD)

---

Top Contributors

[![rayredberry](https://avatars.githubusercontent.com/u/14290166?v=4)](https://github.com/rayredberry "rayredberry (184 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

api-clientlaravellaravel-cloudphpphp-sdksaloonsdkapilaravelsdkcloudsaloonapi clientphp-sdklaravel cloud

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/redberry-laravel-cloud-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/redberry-laravel-cloud-sdk/health.svg)](https://phpackages.com/packages/redberry-laravel-cloud-sdk)
```

###  Alternatives

[defstudio/telegraph

A laravel facade to interact with Telegram Bots

813336.8k3](/packages/defstudio-telegraph)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1123.7k](/packages/codebar-ag-laravel-docuware)[saloonphp/laravel-plugin

The official Laravel plugin for Saloon

807.1M211](/packages/saloonphp-laravel-plugin)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.6k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
