PHP code example of stumason / laravel-coolify

1. Go to this page and download the library: Download stumason/laravel-coolify 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/ */

    

stumason / laravel-coolify example snippets


use Stumason\Coolify\Coolify;

// Deploy
Coolify::deploy();
Coolify::deploy('custom-uuid');

// Status
$status = Coolify::status();
$logs = Coolify::logs();

// Repositories for full control
Coolify::applications()->get($uuid);
Coolify::applications()->deploy($uuid, force: true);
Coolify::applications()->restart($uuid);
Coolify::applications()->envs($uuid);

Coolify::databases()->all();
Coolify::databases()->start($uuid);

Coolify::deployments()->forApplication($uuid);
Coolify::deployments()->cancel($uuid);

Coolify::servers()->all();
Coolify::services()->all();

// config/coolify.php
return [
    'url' => env('COOLIFY_URL'),
    'token' => env('COOLIFY_TOKEN'),
    'project_uuid' => env('COOLIFY_PROJECT_UUID'),  // Set by coolify:provision
    'path' => env('COOLIFY_PATH', 'coolify'),

    'docker' => [
        'php_version' => '8.4',
        'use_base_image' => true,  // Fast builds with pre-built images
    ],
];

// app/Providers/AppServiceProvider.php
use Stumason\Coolify\Coolify;

public function boot(): void
{
    Coolify::auth(function ($request) {
        return $request->user()?->isAdmin();
    });
}
bash
php artisan coolify:provision
bash
php artisan coolify:install