PHP code example of jgamboa / laravel-aurora-dsql

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

    

jgamboa / laravel-aurora-dsql example snippets


'dsql' => [
    'driver' => 'dsql',
    'host' => env('DSQL_HOST'),                 // xxxx.dsql.us-east-1.on.aws
    'port' => env('DSQL_PORT', 5432),           // 5432 on AWS; another port for a local emulator (e.g. Floci)
    'region' => env('AWS_REGION', 'us-east-1'),
    'username' => env('DSQL_USER', 'admin'),    // 'admin' => dsql:DbConnectAdmin; other roles => dsql:DbConnect
    'database' => 'postgres',                   // DSQL has a single database per cluster
    'profile' => env('DSQL_PROFILE'),           // local AWS profile (e.g. SSO). Leave empty on Lambda/EC2/ECS
    'sslrootcert' => env('DSQL_SSLROOTCERT', 'system'), // 'system' 

// A regular migration (no raw SQL)
return new class extends Migration
{
    protected $connection = 'dsql';

    public function up(): void
    {
        Schema::create('products', function (Blueprint $table) {
            $table->uuid('id')->primary();
            $table->foreignUuid('category_id')->constrained()->cascadeOnDelete();
            $table->string('sku')->unique();
            $table->timestamps();
        });
    }
};

// Model: UUID v7 primary keys with HasUuids (Laravel 12+)
class Product extends Model
{
    use HasUuids;

    protected $connection = 'dsql';
}