CWA 2.0 is in alpha: try it, build with it, give feedback. APIs can still change between releases; see Releases.
Overview

API Bundle Overview

What the API Components Bundle provides, the order to read this section in, and a reference for the core resources it registers.

This section is for back-end developers. It covers the Symfony side of a CWA site: the bundle, your component entities, users and security, fixtures and caching. For the Vue side, see the Nuxt Module. If you're new to CWA, start with Core Concepts.

The API Components Bundle is the Symfony backend of CWA. It wires together API Platform, Doctrine ORM, LexikJWTAuthenticationBundle and Mercure, and adds the resources a CWA site is built from: layouts, pages, routes, component groups and your own components.

Reading This Section

PageWhat it covers
Bundle SetupInstalling the bundle, the files to create, and a first admin user
ConfigurationEvery silverback_api_components option and environment variable
Users & SecuritySigning in, user emails, and who can read what
ComponentsYour own component entities, their annotations, and the built-in Collection and Form components
Page Data & Nested PagesPage data, templates, and pages within pages
RoutesURLs, redirects, scheduling and the resource manifest
Data FixturesSeeding a site in code, and capturing one from a database
Real-Time UpdatesThe Mercure hub and the subscriber cookie
HTTP CachingCache safety, tags, purges and flushes
Orphaned DataFinding and deleting content and files nothing uses
Console CommandsEvery command, in brief
Debugging & ErrorsThe profiler panel, error status codes and logged failures

Core Resources

The bundle registers these resources for you. Core resources are served under the /_/ prefix, components under /component/, and page data under /page_data/. These sit below whatever prefix your app mounts API Platform on — /_api in the CWA template, so the full path to layouts is /_api/_/layouts.

ResourceEndpoint prefixPurpose
Layout/_/layoutsOuter page shell (header/footer)
Page/_/pagesIndividual pages with component groups
Route/_/routesURL → page/page data mapping
ComponentGroup/_/component_groupsNamed regions within a layout, page or component
ComponentPosition/_/component_positionsOrdered slot assignments
SiteConfigParameter/_/site_config_parametersKey–value site settings
Collection/component/collectionsProxy to paginated resource lists
Form/component/formsSymfony form types via API

Your own components extend AbstractComponent (see Creating Components), and your page data extends AbstractPageData (see Page Data & Nested Pages). Every core resource except SiteConfigParameter has createdAt and modifiedAt.

Layout

FieldDescription
referenceA unique name, such as main
uiComponentThe Vue layout component that renders it, such as CwaLayoutPrimary
uiClassNamesStyle classes chosen in the admin
componentGroupsIts component groups
pagesThe pages that use it. Read-only

search matches reference and uiComponent.

Page

FieldDescription
referenceA unique name
layoutThe layout it renders in. Required
isTemplateWhether page data renders through it. Required
uiComponent, uiClassNamesThe Vue page component, such as CwaPagePrimaryPageTemplate, and its style classes
title, metaDescriptionUsed for the page's SEO tags
routeThe route that publishes it, if any
parentPage, parentPageDataIts parent in a nested hierarchy
isReachableWithoutRouteAdmin only. See Public Pages Without a Route
componentGroupsIts component groups

search matches title, reference and uiComponent, and isTemplate=true or false filters. Page data has the same title, metaDescription, route, parent and isReachableWithoutRoute fields.

Route

A route maps a path to one page or page data record. Its fields, generation, redirects and go-live dates are covered in Routes.

ComponentGroup

FieldDescription
referenceA unique name. The fixture builder uses {name}_{owner IRI}, or {name}_{locationReference} for a shared group
locationThe IRI of the layout, page or component the group was declared in
layouts, pages, componentsIts owners
componentPositionsIts positions, in order
allowedComponentsCollection IRIs of the component types it accepts. null accepts every type except explicit-allow-only ones

ComponentPosition

FieldDescription
componentGroupThe group it belongs to
componentThe component it shows
sortValueIts order in the group, lowest first
pageDataClass, pageDataPropertySet together to show the component held in a page data property instead. Admin only on read. See Component Positions from PageData

SiteConfigParameter

A key (the identifier, such as siteName) and a JSON value. GET /_/site_config_parameters is public and returns up to 100 parameters, so the front end can read the site's settings. Reading one parameter by its key, and every write, needs publishable.permission. A write also purges every cached page; see Purging Every Rendered Page. The Nuxt module's admin edits them as site settings.

Length Limits

The bundle's text fields are VARCHAR(255) columns. A longer value is a 422, with a violation on the field, before anything is written. These fields have the limit:

ResourceFields
Layout, Page, componentuiComponent. A page's is measured with the CwaPage prefix the API adds
Layout, Page, ComponentGroupreference
Page, page datatitle, metaDescription
ComponentGrouplocation
ComponentPositionpageDataProperty, pageDataClass
Routepath, name
SiteConfigParameterkey
FormformType
CollectionresourceIri
Userusername, emailAddress, newEmailAddress

Editors are most likely to meet it on a page's metaDescription.

SQLite doesn't enforce the length. A local SQLite database saves a 300-character value that PostgreSQL and MySQL reject. Your own string columns need the same care: see String Columns Need a Length Limit.

On the bundle's main branch after 2.0.0-alpha.17 (#430). Before that, a value over 255 characters was a 500 on PostgreSQL and MySQL.