page:guides:laravel:cdn assets
Deliver public assets through CDN for Laravel
Summary
Cdn assets for a Laravel app on Ample. Verified on Laravel: a versioned, immutable-cached asset uploaded to a published bucket and served from the CDN URL. 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.
Resource Requirements
- primitive:compute
- primitive:cdn
Infrastructure Requirements
- Compute: Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.
- CDN: The CDN host serves objects from published buckets. It does not front app compute and is not a cache or key-value store.
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 bucket from
ample bucket createwith credentials passed as encrypted S3_* environment variables - An Ample account token with servers:write, 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
Workflow Steps
- 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.
- Publish a bucket for public assets: Publish only the asset bucket; upload versioned keys with an immutable Cache-Control header and build URLs from its public URL.
- Command: ample bucket publish
- Verify: Fetch the live URL and /p/versioned-static-assets on the example; on failure read the build and runtime logs.
- Command: ample logs --kind build
Examples
- Title: Laravel pattern fixture
Description: Verified CDN assets on Laravel.
Source Ref: tests/deploy-canaries/laravel-patterns
Success Checks
- Check that the app responds on its public URL
- Kind: http_get
- Path: /
- Expect: ample canary laravel patterns
- Versioned-static-assets check from the example
- Kind: http_get
- Path: /p/versioned-static-assets
- 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.
- The CDN serves published-bucket objects only; cache rules, purge and TTL control are not verified.
Cost Estimate
- Currency: USD
- Monthly Amount: 5.0
- Basis: size prices from pricing.toml (loaded by the API) at build revision 1ac5595375130d45290090e82ed0f554ccd45405-dirty
- Components:
- Name: app server
- Size: s-1vcpu-1gb
- Quantity: 1.0
- Monthly Amount: 5.0
- Name: app server
- Note: Always-on monthly price of the tested sizes; apps auto-pause when idle. Buckets are allocation-priced per quota and not included.
Evidence Summary
- Kind: canary_run
Summary: Laravel pattern fixture deployed on Ample (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); for this guide: a versioned, immutable-cached asset uploaded to a published bucket and served from the CDN URL.
Observed At: 2026-09-20T20:36:21Z
Implementation Revision: 118ad1c6d7d23d4c2ce069254bab9ec9d37cd57b-dirty (CLI 118ad1c)
Expires At: 2027-03-19T20:36:21Z
Scope:- Checks: /p/versioned-static-assets
- Template: php-8.5
Next Actions
- Browse the catalog index:
- *Operation Id: catalog_index
- Method: GET
- Relative Path: /v1/catalog
- Search published recipes by intent, stack and constraints:
- Operation Id: search_recipes
- Method: POST
- Relative Path: /v1/catalog/search
- Parameters: {"body":{"limit":5,"query":"Deliver public assets through CDN for Laravel"}}
- Prepare a side-effect-free deployment plan for an authorized project:
- Operation Id: plan_deployment
- Method: POST
- Relative Path: /v1/catalog/plan
- Parameters: {"body":{"inputs":{},"projectId":"","recipeId":"page:guides:laravel:cdn-assets","recipeRevision":"r1"}}