1. Go to this page and download the library: Download sq-dev/coolify-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Coolify\CoolifyConnector;
$coolify = new CoolifyConnector(
token: 'your-api-token',
baseUrl: 'https://app.coolify.io/api/v1',
);
use Coolify\Laravel\Facades\Coolify;
// List all applications
$response = Coolify::applications()->list();
$apps = $response->json();
// Get Coolify version
$version = Coolify::version()->json();
// Create a project
$response = Coolify::projects()->create(name: 'My Project', description: 'Production workloads');
// Deploy an application
$response = Coolify::deployments()->deploy(uuid: 'app-uuid', force: true);
use Coolify\CoolifyConnector;
class DeployController
{
public function __construct(
private CoolifyConnector $coolify,
) {}
public function deploy(string $uuid)
{
return $this->coolify->deployments()->deploy(uuid: $uuid);
}
}
use Coolify\CoolifyConnector;
$coolify = new CoolifyConnector(token: 'your-api-token');
$servers = $coolify->servers()->list()->json();
$databases = $coolify->databases()->list()->json();