page:guides:symfony:cdn assets

Deliver public assets through CDN for Symfony

Summary

Cdn assets for a Symfony app on Ample. Verified on Symfony: 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 with Symfony Runtime's dotenv disabled (extra.runtime.disable_dotenv; .env never ships, its values arrive as encrypted env, and compile-time parameters such as DEFAULT_URI need a default), then FrankenPHP serving public/ (php-server with the index.php fallback) reading PORT on the php-8.5 template with APP_ENV=prod.

Workflow Steps

Build and start

composer install --no-dev from composer.lock with Symfony Runtime's dotenv disabled (extra.runtime.disable_dotenv; .env never ships, its values arrive as encrypted env, and compile-time parameters such as DEFAULT_URI need a default), then FrankenPHP serving public/ (php-server with the index.php fallback) reading PORT on the php-8.5 template with APP_ENV=prod; 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

Prerequisites

Limitations

Success Checks

  1. App responds on its public URL
    • Kind: http_get
    • Path: /
    • Expect: ample canary symfony patterns
  2. Versioned-static-assets check from the example
    • Kind: http_get
    • Path: /p/versioned-static-assets
    • Expect: see the pattern fixture checks

Cost Estimate

Examples

Evidence Summary