## Enforce Private-File Authorization for Laravel

### Summary
Private file access for a Laravel app on Ample. Verified on Laravel: a role-to-document access model with negative tests (401, 403) and an authorized private-bucket round-trip (private=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
- Enforce private-file authorization for Laravel
- Where can I host Enforce private-file authorization built with Laravel?
- I need application identity integration, per-file access rules and negative authorization tests.

### Framework
Laravel

### Workload
Enforce private-file authorization

### Release Status
Published

### Support Status
Verified

### Execution Status
Ready

### 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
- A bucket from `ample bucket create` with credentials passed as encrypted S3_* environment variables
- An Ample account token with servers:write, databases:read, buckets: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

### Workflows 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. **Create the bucket and pass its credentials**  
   Create it once with `ample bucket create`, then pass endpoint, region, bucket and keys with --env; use path-style addressing.  
   Command: `ample deploy . --name  --public --env S3_ENDPOINT=... --env S3_REGION=... --env S3_BUCKET=... --env S3_ACCESS_KEY_ID=... --env S3_SECRET_ACCESS_KEY=...`

3. **Authorize before touching storage**  
   Return 401 for unauthenticated requests and 403 for the wrong role; keep the bucket unpublished and stream objects through the app.

4. **Verify**  
   Fetch the live URL and /p/private-document-library on the example; on failure read the build and runtime logs.  
   Command: `ample logs  --kind build`

### Examples
- **Laravel pattern fixture**: Verified private file access on Laravel.  
  Source Reference: tests/deploy-canaries/laravel-patterns

### Success Checks
- App responds on its public URL (HTTP GET /)
- Private-document-library check from the example (HTTP GET /p/private-document-library)

### 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.
- PutObject and GetObject with path-style addressing are verified; other S3 operations are not.

### Cost Estimate
- **Currency**: USD
- **Monthly Amount**: 10.0
- **Basis**: Size prices from pricing.toml (loaded by the API)
- **Components**:
  - App server: s-1vcpu-1gb, quantity: 1.0, monthly amount: 5.0
  - Managed PostgreSQL database: s-1vcpu-1gb, quantity: 1.0, monthly amount: 5.0
  - 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; a role-to-document access model with negative tests (401, 403) and an authorized private-bucket round-trip.  
  Observed At: 2026-09-20T20:36:21Z
  Expires At: 2027-03-19T20:36:21Z

### Next Actions
- **Browse the catalog index**: GET /v1/catalog
- **Search published recipes by intent**: POST /v1/catalog/search
- **Prepare a deployment plan**: POST /v1/catalog/plan
- **Read the existing authentication setup**: GET /mcp/setup
- **Browse Laravel**: GET /v1/catalog/nodes/stack%3Aframework-laravel
- **Browse Connect app to storage**: GET /v1/catalog/nodes/intent%3Aconnect-app-to-storage
- **Browse Private document library**: GET /v1/catalog/nodes/pattern%3Aprivate-document-library
