## Connect Postgres for Laravel

### Summary
Database connection for a Laravel app on Ample. Verified on Laravel: a managed PostgreSQL database auto-provisioned and injected as DATABASE_URL, with real queries succeeding at request time (records=ok). Build and start: `composer install --no-dev` from `composer.lock`, then `FrankenPHP` serving `public/` (php-server with the index.php fallback) reading `PORT` on the `php-8.5` template.

### Representative Queries
- Connect Postgres for Laravel
- Where can I host Connect Postgres built with Laravel?
- I need driver setup, connection settings, secret handling and a real connection test.

### Prerequisites
- A Laravel project (composer install --no-dev from composer.lock, then FrankenPHP serving public/ (php-server with the index.php fallback) reading PORT on the php-8.5 template)
- A PostgreSQL driver reading DATABASE_URL at runtime
- An Ample account token with servers:write, databases:read

### Tested Configuration
- **Template**: php-8.5
- **Runtime**: php
- **Size**: s-1vcpu-1gb
- **Install**: `composer install --no-dev --prefer-dist --no-interaction --no-progress --optimize-autoloader`
- **Start**: `frankenphp php-server --listen :$PORT --root public`

### Workflow Steps
1. **Build and start**  
   `composer install --no-dev` from `composer.lock`, then `FrankenPHP` serving `public/` (php-server with the index.php fallback) reading `PORT` on the `php-8.5` template; the server must bind `0.0.0.0` on `PORT`.
2. **Read DATABASE_URL at runtime**  
   Open connections from the environment inside handlers or a pool; omit `DATABASE_URL` to auto-provision a managed database or pass `--env DATABASE_URL=...` for an existing one.
3. **Verify**  
   Fetch the live URL and `/p/relational-records` on the example; on failure read the build and runtime logs.  Command: `ample logs --kind build`

### Success Checks
- App responds on its public URL  
   **Kind**: http_get, **Path**: `/`, **Expect**: ample canary laravel patterns  
- Relational-records check from the example  
   **Kind**: http_get, **Path**: `/p/relational-records`, **Expect**: see the pattern fixture checks.

### Limitations
- Verified on the php-8.5 template at s-1vcpu-1gb; other sizes and Laravel major versions are not verified.
- Region, compliance attestations and request-duration limits are unknown and not claimed.
- Managed PostgreSQL 16 only; extensions, connection limits and backup or restore procedures are not verified.

### Cost Estimate
- **Currency**: USD
- **Monthly Amount**: $10.00
- **Components**:
  - **App server**: s-1vcpu-1gb, quantity: 1.0, monthly amount: $5.00
  - **Managed PostgreSQL database**: s-1vcpu-1gb, quantity: 1.0, monthly amount: $5.00
- **Note**: Always-on monthly price of the tested sizes; apps auto-pause when idle.

### Evidence Summary
- **Kind**: canary_run
- **Summary**: Laravel pattern fixture deployed on Ample; for this guide: a managed PostgreSQL database auto-provisioned and injected as DATABASE_URL, with real queries succeeding at request time (records=ok).
- **Observed At**: 2026-09-20T20:36:21Z
- **Scope**: checks: ["/p/relational-records"], template: php-8.5

### Next Actions
- **Browse the catalog index**: GET /v1/catalog
- **Search published recipes by intent, stack and constraints**: POST /v1/catalog/search
- **Prepare a side-effect-free deployment plan for an authorized project**: POST /v1/catalog/plan
- **Read the existing agent authentication setup**: GET /mcp/setup
- **Browse Laravel**: GET /v1/catalog/nodes/stack%3Aframework-laravel
- **Browse Connect app to database**: GET /v1/catalog/nodes/intent%3Aconnect-app-to-database
- **Browse Relational records**: GET /v1/catalog/nodes/pattern%3Arelational-records
