Features
What Mainstay does today
Thirteen parts of one CMS, all running inside your own Laravel application.
Content types are PHP classes
Typed properties with attributes are the schema, the form and the type your editor autocompletes. The class is the type in PHP, mainstay:typescript writes the API's payloads out as TypeScript, and production gets its tables from a migration.
#[Route('/events/{slug}')]
class Event extends Entry
{
#[Text(required: true, localized: true)]
public string $slug;
#[Date(required: true)]
public CarbonImmutable $startsOn;
#[Number(min: 0)]
public ?int $seats;
#[Image(sizes: ['card' => [640, 360]])]
public ?Media $poster;
}
One declaration, read as
Real columns, kept in step
Every type gets a table of its own, with real columns and constraints. mainstay:sync alters a development database to match once MAINSTAY_SCHEMA_SYNC=true is set, and mainstay:schema:check fails CI when a database has drifted from the classes.
$ php artisan mainstay:schema:check ERROR The database does not match the declared content types. ⇂ article.glyph: declared, and the column does not exist ⇂ article.subtitle: in the database, and not declared$ ▍
One query layer, with Gate asked first
Templates, seeders, the admin and the API all read and write through Mainstay::find(), create(), update() and delete(). Filters and sorting are data, not closures, so HTTP carries the same call a template makes.
$articles = Mainstay::paginate(Article::class,
where: ['tags' => $entry->id],
sort: ['-publishedOn'],
perPage: 10,
depth: 1,
);
A page builder made of your classes
Every entry has content: text and the blocks its type allows. The Content tab is the page as your site draws it, each block's fields and images edited in a dialog beside it.
How the page builder works
Served by Laravel
An entry is served at the path its #[Route] builds, through a Blade template, after every route your app declares itself. No Node on the server. To build the front end elsewhere, set mainstay.site.enabled to false: the app then serves no entries itself, and they are read and written over the API and MCP server behind tokens.
#[Route('/docs/{slug}')]
#[Template('docs.page')]
class Doc extends Entry
{
#[Text(required: true, localized: true)]
public string $slug;
}
Translated per field
A field says whether it is translated. A title gets one value per language; a date or a price stays one, so the languages can never drift apart. Each language is served on a host or a path prefix of its own.
- title
- ENOpening nightNLPremièreavond
- path
- /events/opening-night/nl/evenementen/premiereavond
- date
- 12 December 2026 Shared
- price
- € 24,00 Shared
'locales' => [
'en' => 'https://example.com',
'nl' => 'https://example.com/nl',
],
Images written once
One media library for the installation, with alt text in every language and a focal point. Every size a field declares is written as AVIF and WebP when a file is uploaded, as far as the server's GD can. A size added later is written by mainstay:media:reprocess, which queues the missing copies of every image.

Relations, tags and globals
Relations are followed to the depth a read asks for. Tags are the entries of a taxonomy, found again through a real pivot. A global holds a site's menu and footer.
A target in the trash, or gone, reads as missing and keeps its place, rather than failing the read.
Drafts, history and the trash
A change waits as a draft of what differs until it is published. The last 50 versions an entry replaced can be restored (a setting, or all of them), and a deleted entry waits in the trash.
- Draftonly what differs
- Publishedin one transaction
- Revisionrestorable

Accounts and roles
The admin has a sign-in of its own, apart from your site's visitors. Accounts are invited by mail, and a role's capabilities are a grid of the types you register.

Plugins, switched on by config
A package adds types, blocks, field types, admin screens, listeners and AI providers. Only the plugins your config names load, and their screens answer behind the admin's sign-in and a capability of their own.
Browse plugins'plugins' => [Acme\Seo\Seo::class],
#[Icon('star')]
class Seo extends Plugin
{
public static function handle(): string
{
return 'seo';
}
public function types(): array
{
return [SeoRedirect::class, SeoSettings::class];
}
public function listeners(): array
{
return [Published::class => [PurgeCache::class]];
}
}
An API and an MCP server
The same reads and writes over JSON and as tools a language model calls, behind tokens that never hold more than the account that made them. Without a token, only the types marked #[PublicRead] are read.
php artisan mainstay:token [email protected] "CI build" --capability=edit_articles
php artisan mainstay:typescript
AI connectors
Every provider laravel/ai speaks, connected on one admin screen. Code prompts with laravel/ai and reaches whatever the site connected, and a plugin adds a provider of its own.
Connect a provider
Its key from the environment, or saved on the screen and encrypted at rest.
Test it
One word from its cheapest model, or one embedding, with the key kept out of any error.
Choose the defaults
The provider for text, images, speech, transcription, embeddings, reranking and classification.