dimer47/laravel-forge-sdk

PHP SDK for Laravel Forge API - Auto-generated from OpenAPI specification

Maintainers

Package info

github.com/dimer47/laravel-forge-sdk

pkg:composer/dimer47/laravel-forge-sdk

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-01-24 14:35 UTC

This package is auto-updated.

Last update: 2026-03-24 15:09:18 UTC


README

Latest Version on Packagist Total Downloads License

A comprehensive PHP SDK for the Laravel Forge API, auto-generated from the official OpenAPI specification.

Features

  • Complete API Coverage: All Laravel Forge endpoints
  • Type-Safe: Fully typed request/response models
  • PSR-7/PSR-18 Compatible: Uses Guzzle HTTP client
  • Modern PHP: Requires PHP 8.1+
  • Well Documented: Inline documentation and examples

Installation & Usage

Requirements

PHP 8.1 and later.

Composer

composer require dimer47/laravel-forge-sdk

Or add the following to composer.json:

{
  "require": {
    "dimer47/laravel-forge-sdk": "^1.0"
  }
}

Then run composer install

Quick Start

<?php
require_once __DIR__ . '/vendor/autoload.php';

use Dimer47\LaravelForgeSdk\Configuration;
use Dimer47\LaravelForgeSdk\Api\ServersApi;

// Configure API token
$config = Configuration::getDefaultConfiguration()
    ->setAccessToken('your-forge-api-token');

// Create API instance
$serversApi = new ServersApi(
    new GuzzleHttp\Client(),
    $config
);

// List servers
$servers = $serversApi->organizationsServersIndex('your-organization');

foreach ($servers->getData() as $server) {
    echo $server->getAttributes()->getName() . "\n";
}

Configuration

Authentication

Laravel Forge API uses Bearer token authentication. Generate a token from your Forge account settings.

use Dimer47\LaravelForgeSdk\Configuration;

$config = Configuration::getDefaultConfiguration()
    ->setAccessToken('your-forge-api-token');

Custom HTTP Client

You can provide your own Guzzle client:

use GuzzleHttp\Client;
use Dimer47\LaravelForgeSdk\Api\ServersApi;

$client = new Client([
    'timeout' => 30,
    'verify' => true,
]);

$serversApi = new ServersApi($client, $config);

Usage Examples

Managing Servers

use Dimer47\LaravelForgeSdk\Api\ServersApi;
use Dimer47\LaravelForgeSdk\Model\CreateServerRequest;

$serversApi = new ServersApi(null, $config);

// List servers
$servers = $serversApi->organizationsServersIndex('my-org');

// Get a specific server
$server = $serversApi->organizationsServersShow('my-org', 123456);

// Create a server
$request = new CreateServerRequest([
    'name' => 'my-server',
    'provider' => 'ocean2',
    'region' => 'nyc3',
    'size' => 's-1vcpu-1gb',
    'php_version' => '8.3',
]);
$newServer = $serversApi->organizationsServersStore('my-org', $request);

// Reboot a server
$serversApi->organizationsServersActionsStore('my-org', 123456, ['action' => 'reboot']);

// Delete a server
$serversApi->organizationsServersDestroy('my-org', 123456);

Managing Sites

use Dimer47\LaravelForgeSdk\Api\SitesApi;
use Dimer47\LaravelForgeSdk\Model\CreateSiteRequest;

$sitesApi = new SitesApi(null, $config);

// List sites on a server
$sites = $sitesApi->organizationsServersSitesIndex('my-org', 123456);

// Create a site
$request = new CreateSiteRequest([
    'domain' => 'example.com',
    'project_type' => 'php',
    'directory' => '/public',
]);
$site = $sitesApi->organizationsServersSitesStore('my-org', 123456, $request);

// Get/Update Nginx configuration
$nginxConfig = $sitesApi->organizationsServersSitesNginxShow('my-org', 123456, 789);

// Get/Update .env file
$env = $sitesApi->organizationsServersSitesEnvironmentShow('my-org', 123456, 789);

Managing Deployments

use Dimer47\LaravelForgeSdk\Api\DeploymentsApi;

$deploymentsApi = new DeploymentsApi(null, $config);

// Trigger a deployment
$deploymentsApi->organizationsServersSitesDeploymentsStore('my-org', 123456, 789);

// Get deployment script
$script = $deploymentsApi->organizationsServersSitesDeploymentsScriptShow('my-org', 123456, 789);

// Get deployment status
$status = $deploymentsApi->organizationsServersSitesDeploymentsStatusShow('my-org', 123456, 789);

// Enable push-to-deploy
$deploymentsApi->organizationsServersSitesDeploymentsPushToDeployStore('my-org', 123456, 789);

Managing Databases

use Dimer47\LaravelForgeSdk\Api\DatabasesApi;
use Dimer47\LaravelForgeSdk\Model\CreateDatabaseRequest;
use Dimer47\LaravelForgeSdk\Model\CreateDatabaseUserRequest;

$databasesApi = new DatabasesApi(null, $config);

// Create a database
$request = new CreateDatabaseRequest(['name' => 'my_database']);
$databasesApi->organizationsServersDatabaseSchemasStore('my-org', 123456, $request);

// Create a database user
$userRequest = new CreateDatabaseUserRequest([
    'name' => 'my_user',
    'password' => 'secure_password',
    'database_ids' => [1, 2, 3],
]);
$databasesApi->organizationsServersDatabaseUsersStore('my-org', 123456, $userRequest);

// List databases
$databases = $databasesApi->organizationsServersDatabaseSchemasIndex('my-org', 123456);

Managing Background Processes (Daemons)

use Dimer47\LaravelForgeSdk\Api\BackgroundProcessesApi;

$daemonsApi = new BackgroundProcessesApi(null, $config);

// List daemons
$daemons = $daemonsApi->organizationsServersBackgroundProcessesIndex('my-org', 123456);

// Create a daemon
$daemonsApi->organizationsServersBackgroundProcessesStore('my-org', 123456, [
    'command' => 'php /home/forge/example.com/artisan queue:work',
    'user' => 'forge',
    'directory' => '/home/forge/example.com',
]);

Managing Scheduled Jobs (Cron)

use Dimer47\LaravelForgeSdk\Api\ScheduledJobsApi;
use Dimer47\LaravelForgeSdk\Model\CreateScheduledJobRequest;

$cronApi = new ScheduledJobsApi(null, $config);

// Create a cron job
$request = new CreateScheduledJobRequest([
    'command' => 'php /home/forge/example.com/artisan schedule:run',
    'frequency' => 'minutely',
    'user' => 'forge',
]);
$cronApi->organizationsServersScheduledJobsStore('my-org', 123456, $request);

Managing Laravel Integrations

use Dimer47\LaravelForgeSdk\Api\IntegrationsApi;

$integrationsApi = new IntegrationsApi(null, $config);

// Enable Laravel Horizon
$integrationsApi->organizationsServersSitesIntegrationsHorizonStore('my-org', 123456, 789);

// Enable Laravel Octane
$integrationsApi->organizationsServersSitesIntegrationsOctaneStore('my-org', 123456, 789, [
    'server' => 'swoole',
    'port' => 8000,
]);

// Enable Laravel Reverb (WebSockets)
$integrationsApi->organizationsServersSitesIntegrationsReverbStore('my-org', 123456, 789, [
    'port' => 6001,
]);

// Get integration status
$status = $integrationsApi->organizationsServersSitesIntegrationsHorizonShow('my-org', 123456, 789);

API Endpoints

All URIs are relative to https://forge.laravel.com/api

Class Method HTTP request Description
BackgroundProcessesApi organizationsServersBackgroundProcessesDestroy DELETE /orgs/{organization}/servers/{server}/background-processes/{backgroundProcess} Delete background process
BackgroundProcessesApi organizationsServersBackgroundProcessesIndex GET /orgs/{organization}/servers/{server}/background-processes List background processes
BackgroundProcessesApi organizationsServersBackgroundProcessesLogShow GET /orgs/{organization}/servers/{server}/background-processes/{backgroundProcess}/log Get background process log
BackgroundProcessesApi organizationsServersBackgroundProcessesShow GET /orgs/{organization}/servers/{server}/background-processes/{backgroundProcess} Get background process
BackgroundProcessesApi organizationsServersBackgroundProcessesStore POST /orgs/{organization}/servers/{server}/background-processes Create background process
BackgroundProcessesApi organizationsServersBackgroundProcessesUpdate PUT /orgs/{organization}/servers/{server}/background-processes/{backgroundProcess} Update background process
BackupsApi organizationsServersDatabaseBackupsDestroy DELETE /orgs/{organization}/servers/{server}/database/backups/{backupConfiguration} Delete backup configuration
BackupsApi organizationsServersDatabaseBackupsIndex GET /orgs/{organization}/servers/{server}/database/backups List backup configurations
BackupsApi organizationsServersDatabaseBackupsInstancesDestroy DELETE /orgs/{organization}/servers/{server}/database/backups/{backupConfiguration}/instances/{backup} Delete backup
BackupsApi organizationsServersDatabaseBackupsInstancesIndex GET /orgs/{organization}/servers/{server}/database/backups/{backupConfiguration}/instances List backups
BackupsApi organizationsServersDatabaseBackupsInstancesRestoresStore POST /orgs/{organization}/servers/{server}/database/backups/{backupConfiguration}/instances/{backup}/restores Create a database restore from backup
BackupsApi organizationsServersDatabaseBackupsInstancesShow GET /orgs/{organization}/servers/{server}/database/backups/{backupConfiguration}/instances/{backup} Get backup
BackupsApi organizationsServersDatabaseBackupsInstancesStore POST /orgs/{organization}/servers/{server}/database/backups/{backupConfiguration}/instances Create backup
BackupsApi organizationsServersDatabaseBackupsShow GET /orgs/{organization}/servers/{server}/database/backups/{backupConfiguration} Get backup configuration
BackupsApi organizationsServersDatabaseBackupsStore POST /orgs/{organization}/servers/{server}/database/backups Create backup configuration
BackupsApi organizationsServersDatabaseBackupsUpdate PUT /orgs/{organization}/servers/{server}/database/backups/{backupConfiguration} Update backup configuration
CommandsApi organizationsServersSitesCommandsDestroy DELETE /orgs/{organization}/servers/{server}/sites/{site}/commands/{command} Delete command
CommandsApi organizationsServersSitesCommandsIndex GET /orgs/{organization}/servers/{server}/sites/{site}/commands List commands
CommandsApi organizationsServersSitesCommandsOutputShow GET /orgs/{organization}/servers/{server}/sites/{site}/commands/{command}/output Get command output
CommandsApi organizationsServersSitesCommandsShow GET /orgs/{organization}/servers/{server}/sites/{site}/commands/{command} Get command
CommandsApi organizationsServersSitesCommandsStore POST /orgs/{organization}/servers/{server}/sites/{site}/commands Create command
DatabasesApi organizationsServersDatabasePasswordUpdate PUT /orgs/{organization}/servers/{server}/database/password Update the password for the database
DatabasesApi organizationsServersDatabaseSchemasDestroy DELETE /orgs/{organization}/servers/{server}/database/schemas/{database} Delete database schema
DatabasesApi organizationsServersDatabaseSchemasIndex GET /orgs/{organization}/servers/{server}/database/schemas List database schemas
DatabasesApi organizationsServersDatabaseSchemasShow GET /orgs/{organization}/servers/{server}/database/schemas/{database} Get database schema
DatabasesApi organizationsServersDatabaseSchemasStore POST /orgs/{organization}/servers/{server}/database/schemas Create database schema
DatabasesApi organizationsServersDatabaseSchemasSynchronizationsStore POST /orgs/{organization}/servers/{server}/database/schemas/synchronizations Update database schemas
DatabasesApi organizationsServersDatabaseUsersDestroy DELETE /orgs/{organization}/servers/{server}/database/users/{databaseUser} Delete database user
DatabasesApi organizationsServersDatabaseUsersIndex GET /orgs/{organization}/servers/{server}/database/users List database users
DatabasesApi organizationsServersDatabaseUsersShow GET /orgs/{organization}/servers/{server}/database/users/{databaseUser} Get database user
DatabasesApi organizationsServersDatabaseUsersStore POST /orgs/{organization}/servers/{server}/database/users Create database user
DatabasesApi organizationsServersDatabaseUsersUpdate PUT /orgs/{organization}/servers/{server}/database/users/{databaseUser} Update database user
DeploymentsApi organizationsServersSitesDeploymentsDeployHookShow GET /orgs/{organization}/servers/{server}/sites/{site}/deployments/deploy-hook Get the deployment trigger URL
DeploymentsApi organizationsServersSitesDeploymentsDeployHookUpdate PUT /orgs/{organization}/servers/{server}/sites/{site}/deployments/deploy-hook Update deployment trigger URL
DeploymentsApi organizationsServersSitesDeploymentsIndex GET /orgs/{organization}/servers/{server}/sites/{site}/deployments List deployments
DeploymentsApi organizationsServersSitesDeploymentsLogShow GET /orgs/{organization}/servers/{server}/sites/{site}/deployments/{deployment}/log Get deployment output
DeploymentsApi organizationsServersSitesDeploymentsPushToDeployDestroy DELETE /orgs/{organization}/servers/{server}/sites/{site}/deployments/push-to-deploy Delete push to deploy configuration
DeploymentsApi organizationsServersSitesDeploymentsPushToDeployStore POST /orgs/{organization}/servers/{server}/sites/{site}/deployments/push-to-deploy Create push to deploy configuration
DeploymentsApi organizationsServersSitesDeploymentsScriptShow GET /orgs/{organization}/servers/{server}/sites/{site}/deployments/script Get deployment script
DeploymentsApi organizationsServersSitesDeploymentsScriptUpdate PUT /orgs/{organization}/servers/{server}/sites/{site}/deployments/script Update deployment script
DeploymentsApi organizationsServersSitesDeploymentsShow GET /orgs/{organization}/servers/{server}/sites/{site}/deployments/{deployment} Get deployment
DeploymentsApi organizationsServersSitesDeploymentsStatusDestroy DELETE /orgs/{organization}/servers/{server}/sites/{site}/deployments/status Update deployment state
DeploymentsApi organizationsServersSitesDeploymentsStatusShow GET /orgs/{organization}/servers/{server}/sites/{site}/deployments/status Get deployment status
DeploymentsApi organizationsServersSitesDeploymentsStore POST /orgs/{organization}/servers/{server}/sites/{site}/deployments Create deployment
DeploymentsApi organizationsServersSitesWebhooksDestroy DELETE /orgs/{organization}/servers/{server}/sites/{site}/webhooks/{deploymentWebhook} Delete site webhook
DeploymentsApi organizationsServersSitesWebhooksIndex GET /orgs/{organization}/servers/{server}/sites/{site}/webhooks List site webhooks
DeploymentsApi organizationsServersSitesWebhooksShow GET /orgs/{organization}/servers/{server}/sites/{site}/webhooks/{deploymentWebhook} Get site webhook
DeploymentsApi organizationsServersSitesWebhooksStore POST /orgs/{organization}/servers/{server}/sites/{site}/webhooks Create site webhook
FirewallRulesApi organizationsServersFirewallRulesDestroy DELETE /orgs/{organization}/servers/{server}/firewall-rules/{rule} Delete server firewall rule
FirewallRulesApi organizationsServersFirewallRulesIndex GET /orgs/{organization}/servers/{server}/firewall-rules List server firewall rules
FirewallRulesApi organizationsServersFirewallRulesShow GET /orgs/{organization}/servers/{server}/firewall-rules/{rule} Get server firewall rule
FirewallRulesApi organizationsServersFirewallRulesStore POST /orgs/{organization}/servers/{server}/firewall-rules Create server firewall rule
IntegrationsApi organizationsServersSitesIntegrationsHorizonDestroy DELETE /orgs/{organization}/servers/{server}/sites/{site}/integrations/horizon Delete Laravel Horizon integration
IntegrationsApi organizationsServersSitesIntegrationsHorizonShow GET /orgs/{organization}/servers/{server}/sites/{site}/integrations/horizon Get Laravel Horizon integration status
IntegrationsApi organizationsServersSitesIntegrationsHorizonStore POST /orgs/{organization}/servers/{server}/sites/{site}/integrations/horizon Create Laravel Horizon integration
IntegrationsApi organizationsServersSitesIntegrationsInertiaShow GET /orgs/{organization}/servers/{server}/sites/{site}/integrations/inertia Get Inertia integration status
IntegrationsApi organizationsServersSitesIntegrationsInertiaStore POST /orgs/{organization}/servers/{server}/sites/{site}/integrations/inertia Create Inertia integration
IntegrationsApi organizationsServersSitesIntegrationsLaravelMaintenanceDestroy DELETE /orgs/{organization}/servers/{server}/sites/{site}/integrations/laravel-maintenance Delete Laravel Maintenance integration
IntegrationsApi organizationsServersSitesIntegrationsLaravelMaintenanceShow GET /orgs/{organization}/servers/{server}/sites/{site}/integrations/laravel-maintenance Get Laravel Maintenance integration status
IntegrationsApi organizationsServersSitesIntegrationsLaravelMaintenanceStore POST /orgs/{organization}/servers/{server}/sites/{site}/integrations/laravel-maintenance Create Laravel Maintenance integration
IntegrationsApi organizationsServersSitesIntegrationsLaravelSchedulerDestroy DELETE /orgs/{organization}/servers/{server}/sites/{site}/integrations/laravel-scheduler Delete Laravel Scheduler integration job
IntegrationsApi organizationsServersSitesIntegrationsLaravelSchedulerShow GET /orgs/{organization}/servers/{server}/sites/{site}/integrations/laravel-scheduler Get Laravel Scheduler integration job
IntegrationsApi organizationsServersSitesIntegrationsLaravelSchedulerStore POST /orgs/{organization}/servers/{server}/sites/{site}/integrations/laravel-scheduler Create Laravel Scheduler integration job
IntegrationsApi organizationsServersSitesIntegrationsOctaneDestroy DELETE /orgs/{organization}/servers/{server}/sites/{site}/integrations/octane Delete Laravel Octane integration
IntegrationsApi organizationsServersSitesIntegrationsOctaneShow GET /orgs/{organization}/servers/{server}/sites/{site}/integrations/octane Get Laravel Octane integration status
IntegrationsApi organizationsServersSitesIntegrationsOctaneStore POST /orgs/{organization}/servers/{server}/sites/{site}/integrations/octane Create Laravel Octane integration
IntegrationsApi organizationsServersSitesIntegrationsPulseDestroy DELETE /orgs/{organization}/servers/{server}/sites/{site}/integrations/pulse Delete Laravel Pulse integration
IntegrationsApi organizationsServersSitesIntegrationsPulseShow GET /orgs/{organization}/servers/{server}/sites/{site}/integrations/pulse Get Laravel Pulse integration status
IntegrationsApi organizationsServersSitesIntegrationsPulseStore POST /orgs/{organization}/servers/{server}/sites/{site}/integrations/pulse Create Laravel Pulse integration
IntegrationsApi organizationsServersSitesIntegrationsReverbDestroy DELETE /orgs/{organization}/servers/{server}/sites/{site}/integrations/reverb Delete Laravel Reverb integration
IntegrationsApi organizationsServersSitesIntegrationsReverbShow GET /orgs/{organization}/servers/{server}/sites/{site}/integrations/reverb Get Laravel Reverb integration status
IntegrationsApi organizationsServersSitesIntegrationsReverbStore POST /orgs/{organization}/servers/{server}/sites/{site}/integrations/reverb Create Laravel Reverb integration
LogsApi organizationsServersLogsDestroy DELETE /orgs/{organization}/servers/{server}/logs/{key} Delete server log content
LogsApi organizationsServersLogsShow GET /orgs/{organization}/servers/{server}/logs/{key} Get server log content
MonitorsApi organizationsServersMonitorsDestroy DELETE /orgs/{organization}/servers/{server}/monitors/{monitor} Delete server monitor
MonitorsApi organizationsServersMonitorsIndex GET /orgs/{organization}/servers/{server}/monitors List server monitors
MonitorsApi organizationsServersMonitorsShow GET /orgs/{organization}/servers/{server}/monitors/{monitor} Get server monitor
MonitorsApi organizationsServersMonitorsStore POST /orgs/{organization}/servers/{server}/monitors Create server monitor
NginxApi organizationsServersNginxTemplatesDestroy DELETE /orgs/{organization}/servers/{server}/nginx/templates/{nginxTemplate} Delete Nginx template
NginxApi organizationsServersNginxTemplatesIndex GET /orgs/{organization}/servers/{server}/nginx/templates List Nginx templates
NginxApi organizationsServersNginxTemplatesShow GET /orgs/{organization}/servers/{server}/nginx/templates/{nginxTemplate} Get Nginx template
NginxApi organizationsServersNginxTemplatesStore POST /orgs/{organization}/servers/{server}/nginx/templates Create Nginx template
NginxApi organizationsServersNginxTemplatesUpdate PUT /orgs/{organization}/servers/{server}/nginx/templates/{nginxTemplate} Update Nginx template
OrganizationsApi organizationsIndex GET /orgs List organizations
OrganizationsApi organizationsServerCredentialsIndex GET /orgs/{organization}/server-credentials List server credentials
OrganizationsApi organizationsServerCredentialsShow GET /orgs/{organization}/server-credentials/{credential} Get server credential
OrganizationsApi organizationsServerCredentialsVpcsIndex GET /orgs/{organization}/server-credentials/{credential}/regions/{region}/vpcs List VPCs
OrganizationsApi organizationsServerCredentialsVpcsShow GET /orgs/{organization}/server-credentials/{credential}/regions/{region}/vpcs/{vpcId} Get VPC
OrganizationsApi organizationsServerCredentialsVpcsStore POST /orgs/{organization}/server-credentials/{credential}/regions/{region}/vpcs Create a new VPC
OrganizationsApi organizationsShow GET /orgs/{organization} Get organization
ProvidersApi providersIndex GET /providers List providers
ProvidersApi providersRegionsIndex GET /providers/{provider}/regions List provider regions
ProvidersApi providersRegionsShow GET /providers/{provider}/regions/{providerRegion} Get provider region
ProvidersApi providersRegionsSizesIndex GET /providers/{provider}/regions/{providerRegion}/sizes List provider region sizes
ProvidersApi providersRegionsSizesShow GET /providers/{provider}/regions/{providerRegion}/sizes/{providerSize} Get provider region size
ProvidersApi providersShow GET /providers/{provider} Get provider
ProvidersApi providersSizesIndex GET /providers/{provider}/sizes List provider sizes
ProvidersApi providersSizesShow GET /providers/{provider}/sizes/{providerSize} Get provider size
RecipesApi forgeRecipesIndex GET /forge-recipes List Forge's recipes
RecipesApi forgeRecipesRunsStore POST /forge-recipes/{forgeRecipe}/runs Create Forge recipe run
RecipesApi forgeRecipesShow GET /forge-recipes/{forgeRecipe} Get Forge recipe
RecipesApi organizationRecipesStore POST /orgs/{organization}/recipes Create recipe
RecipesApi organizationsRecipesDestroy DELETE /orgs/{organization}/recipes/{recipe} Delete recipe
RecipesApi organizationsRecipesIndex GET /orgs/{organization}/recipes List organization recipes
RecipesApi organizationsRecipesRunsIndex GET /orgs/{organization}/recipes/{recipe}/runs List recipe runs
RecipesApi organizationsRecipesRunsShow GET /orgs/{organization}/recipes/{recipe}/runs/{log} Get recipe run
RecipesApi organizationsRecipesRunsStore POST /orgs/{organization}/recipes/{recipe}/runs Create recipe run
RecipesApi organizationsRecipesShow GET /orgs/{organization}/recipes/{recipe} Get recipe
RecipesApi organizationsRecipesUpdate PUT /orgs/{organization}/recipes/{recipe} Update recipe
RedirectRulesApi organizationsServersSitesRedirectRulesDestroy DELETE /orgs/{organization}/servers/{server}/sites/{site}/redirect-rules/{redirectRule} Delete site redirect rule
RedirectRulesApi organizationsServersSitesRedirectRulesIndex GET /orgs/{organization}/servers/{server}/sites/{site}/redirect-rules List site redirect rules
RedirectRulesApi organizationsServersSitesRedirectRulesShow GET /orgs/{organization}/servers/{server}/sites/{site}/redirect-rules/{redirectRule} Get site redirect rule
RedirectRulesApi organizationsServersSitesRedirectRulesStore POST /orgs/{organization}/servers/{server}/sites/{site}/redirect-rules Create site redirect rule
RolesApi organizationsRolesDestroy DELETE /orgs/{organization}/roles/{role} Delete role
RolesApi organizationsRolesIndex GET /orgs/{organization}/roles List roles
RolesApi organizationsRolesPermissionsIndex GET /orgs/{organization}/roles/{role}/permissions List role permissions
RolesApi organizationsRolesShow GET /orgs/{organization}/roles/{role} Get role
RolesApi organizationsRolesStore POST /orgs/{organization}/roles Create role
RolesApi organizationsRolesUpdate PUT /orgs/{organization}/roles/{role} Update role
SSHKeysApi organizationsServersKeyShow GET /orgs/{organization}/servers/{server}/key Get server public SSH key
SSHKeysApi organizationsServersSshKeysDestroy DELETE /orgs/{organization}/servers/{server}/ssh-keys/{key} Delete server SSH key
SSHKeysApi organizationsServersSshKeysIndex GET /orgs/{organization}/servers/{server}/ssh-keys List server SSH keys
SSHKeysApi organizationsServersSshKeysShow GET /orgs/{organization}/servers/{server}/ssh-keys/{key} Get server SSH key
SSHKeysApi organizationsServersSshKeysStore POST /orgs/{organization}/servers/{server}/ssh-keys Create server SSH key
ScheduledJobsApi organizationsServersScheduledJobsDestroy DELETE /orgs/{organization}/servers/{server}/scheduled-jobs/{job} Delete scheduled job
ScheduledJobsApi organizationsServersScheduledJobsIndex GET /orgs/{organization}/servers/{server}/scheduled-jobs List server scheduled jobs
ScheduledJobsApi organizationsServersScheduledJobsOutputsShow GET /orgs/{organization}/servers/{server}/scheduled-jobs/{job}/output Get scheduled job output
ScheduledJobsApi organizationsServersScheduledJobsShow GET /orgs/{organization}/servers/{server}/scheduled-jobs/{job} Get scheduled job
ScheduledJobsApi organizationsServersScheduledJobsStore POST /orgs/{organization}/servers/{server}/scheduled-jobs Create scheduled job
SecurityRulesApi organizationsServersSitesSecurityRulesDestroy DELETE /orgs/{organization}/servers/{server}/sites/{site}/security-rules/{securityRule} Delete site security rule
SecurityRulesApi organizationsServersSitesSecurityRulesIndex GET /orgs/{organization}/servers/{server}/sites/{site}/security-rules List site security rules
SecurityRulesApi organizationsServersSitesSecurityRulesShow GET /orgs/{organization}/servers/{server}/sites/{site}/security-rules/{securityRule} Get site security rule
SecurityRulesApi organizationsServersSitesSecurityRulesStore POST /orgs/{organization}/servers/{server}/sites/{site}/security-rules Create site security rule
SecurityRulesApi organizationsServersSitesSecurityRulesUpdate PUT /orgs/{organization}/servers/{server}/sites/{site}/security-rules/{securityRule} Update site security rule
ServersApi organizationsServersActionsStore POST /orgs/{organization}/servers/{server}/actions Create server action
ServersApi organizationsServersDestroy DELETE /orgs/{organization}/servers/{server} Delete server
ServersApi organizationsServersEventsIndex GET /orgs/{organization}/servers/{server}/events List server events
ServersApi organizationsServersIndex GET /orgs/{organization}/servers List servers
ServersApi organizationsServersShow GET /orgs/{organization}/servers/{server} Get server
ServersApi organizationsServersStore POST /orgs/{organization}/servers Create server
SitesApi organizationsServersSitesDestroy DELETE /orgs/{organization}/servers/{server}/sites/{site} Delete site
SitesApi organizationsServersSitesIndex GET /orgs/{organization}/servers/{server}/sites List sites for server
SitesApi organizationsServersSitesStore POST /orgs/{organization}/servers/{server}/sites Create site
SitesApi organizationsServersSitesUpdate PUT /orgs/{organization}/servers/{server}/sites/{site} Update site
SitesApi organizationsSitesIndex GET /orgs/{organization}/sites List sites for Organization
SitesApi sitesIndex GET /sites List sites
StorageProvidersApi organizationsStorageProvidersDestroy DELETE /orgs/{organization}/storage-providers/{storageConfiguration} Delete storage provider
StorageProvidersApi organizationsStorageProvidersIndex GET /orgs/{organization}/storage-providers List storage providers
StorageProvidersApi organizationsStorageProvidersShow GET /orgs/{organization}/storage-providers/{storageConfiguration} Get storage provider
StorageProvidersApi organizationsStorageProvidersStore POST /orgs/{organization}/storage-providers Create storage provider
StorageProvidersApi organizationsStorageProvidersUpdate PUT /orgs/{organization}/storage-providers/{storageConfiguration} Update storage provider
TeamsApi organizationsTeamsDestroy DELETE /orgs/{organization}/teams/{team} Delete team
TeamsApi organizationsTeamsIndex GET /orgs/{organization}/teams List teams
TeamsApi organizationsTeamsShow GET /orgs/{organization}/teams/{team} Get team
TeamsApi organizationsTeamsStore POST /orgs/{organization}/teams Create team
TeamsApi organizationsTeamsUpdate PUT /orgs/{organization}/teams/{team} Update team
UserApi me GET /me Get user
UserApi userShow GET /user Get user

Available API Classes

Class Description
BackgroundProcessesApi Manage daemons/supervisor processes
BackupsApi Database backup management
CommandsApi Execute commands on sites
DatabasesApi Database and user management
DeploymentsApi Deployment management
FirewallRulesApi Firewall rule management
IntegrationsApi Laravel integrations (Horizon, Octane, etc.)
LogsApi Server log management
MonitorsApi Server monitoring
NginxApi Nginx template management
OrganizationsApi Organization management
ProvidersApi Cloud provider information
RecipesApi Automation recipes
RedirectRulesApi Redirect rule management
RolesApi Role and permission management
SSHKeysApi SSH key management
ScheduledJobsApi Cron job management
SecurityRulesApi Security rule management
ServerCredentialsApi Server credential management
ServersApi Server management
SitesApi Site management
StorageProvidersApi Storage provider management
TeamsApi Team management
UserApi Current user information

Error Handling

use Dimer47\LaravelForgeSdk\ApiException;

try {
    $server = $serversApi->organizationsServersShow('my-org', 999999);
} catch (ApiException $e) {
    echo "Error: " . $e->getMessage() . "\n";
    echo "Status Code: " . $e->getCode() . "\n";
    echo "Response Body: " . $e->getResponseBody() . "\n";

    // Get response headers
    $headers = $e->getResponseHeaders();
}

Rate Limiting

Laravel Forge API has a rate limit of 60 requests per minute. The SDK does not handle rate limiting automatically. Consider implementing retry logic:

use Dimer47\LaravelForgeSdk\ApiException;

function withRetry(callable $callback, int $maxRetries = 3)
{
    $attempts = 0;

    while ($attempts < $maxRetries) {
        try {
            return $callback();
        } catch (ApiException $e) {
            if ($e->getCode() === 429) {
                $attempts++;
                sleep(60); // Wait 1 minute
                continue;
            }
            throw $e;
        }
    }

    throw new \RuntimeException('Max retries exceeded');
}

$servers = withRetry(fn() => $serversApi->organizationsServersIndex('my-org'));

Laravel Integration

For Laravel projects, you can create a service provider:

// app/Providers/ForgeServiceProvider.php
namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Dimer47\LaravelForgeSdk\Configuration;
use Dimer47\LaravelForgeSdk\Api\ServersApi;
use Dimer47\LaravelForgeSdk\Api\SitesApi;

class ForgeServiceProvider extends ServiceProvider
{
    public function register()
    {
        $this->app->singleton(Configuration::class, function () {
            return Configuration::getDefaultConfiguration()
                ->setAccessToken(config('services.forge.token'));
        });

        $this->app->bind(ServersApi::class, function ($app) {
            return new ServersApi(null, $app->make(Configuration::class));
        });

        $this->app->bind(SitesApi::class, function ($app) {
            return new SitesApi(null, $app->make(Configuration::class));
        });
    }
}

Then use it:

// In a controller or command
public function __construct(private ServersApi $serversApi) {}

public function index()
{
    $servers = $this->serversApi->organizationsServersIndex('my-org');
}

Authorization

Authentication schemes defined for the API:

Bearer Token (http)

  • Type: Bearer authentication

OAuth2

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: https://forge.laravel.com/oauth/authorize

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Contributing

Please see CONTRIBUTING.md for details.

Security

If you discover any security-related issues, please use the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 0.0.1
  • Generator version: 7.19.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen