Textstem: The AI-First Content Management Framework for Laravel

Textstem is a Laravel package for developers building content-managed sites. Instead of one "blob of text" per page, pages are built from blocks, posts live in typed collections, and AI help is built into the editing workflow.

It is installed into a Laravel app with Composer and adds an admin at /textstem, a page builder, a media library, a REST API and more. Developing With Textstem is the technical starting point.


Key Concepts

1. Wrangler Pages & Components

Textstem replaces the traditional "page body" with a page and component model.

  • Wrangler Pages: the container for a URL, holding its metadata (SEO fields, JSON-LD) and the template it uses.
  • Wrangler Components: blocks of content (a prose section, a hero, a gallery, a form…) placed in named slots of the page. The package ships a Prose block (and Active Form with Form Data); sites add their own.
  • Regions: templates mark where blocks can go with <region> elements, so layouts stay flexible without hard-coding.

2. AI in the workflow

  • Prompt library: the package's prompts can be edited in the admin, without a deploy.
  • Context: AI actions run with the page or record being edited, its fields and the user.
  • Checked output: structured AI output is validated against a schema before it changes anything.
  • Your choice of model: OpenAI or Anthropic, with every call's tokens and cost logged.

3. Asset Management

A media library that does more than store files:

  • Processing status: thumbnails, metadata and fingerprints are made in background jobs, and the library shows their progress.
  • Auto-metadata: AI-written alt text for uploaded images.
  • Fingerprints to spot duplicate uploads, and image presets and crops for responsive output.

4. Versions and approval

  • Versions: pages, blocks and posts keep earlier versions, which editors can restore.
  • Content approval: editors who can't publish send drafts to a publisher, who approves, schedules or sends them back. Every step is recorded. See Content approval.

Developer Features

  • Artisan scaffolding: generate page blocks, admin tools, modules, dashboard widgets and template commands with php artisan textstem:make:*.
  • Headless ready: a JSON:API REST API returns pages with their blocks; there is also an MCP server for AI assistants.
  • Live updates: model and AI-job events broadcast over Laravel Echo (Pusher, Reverb, Soketi…) when broadcasting is set up.
  • Extensible: host-app classes and views override the package's by name, and the logic sits in services and actions you can swap.

Architecture Overview

  • Frontend: public pages render with Blade (and Livewire), or optionally with React through Inertia. The admin is Blade and Livewire.
  • Database: standard Eloquent models, with traits for slugs, tags, versions and search.
  • Search: a built-in admin search, and Laravel Scout on pages and posts for site search. See Search.

Getting Started

# Install via Composer
composer require medialight/textstem-laravel

# Run the interactive setup
php artisan textstem:post-install

For the full steps, see the Installation Guide or the API Reference.

In this section

  • Architecture — A technical tour of Textstem: its architecture, the Wrangler page builder, models, facades, the REST API and the MCP server.
  • Pages — How Wrangler pages work: the page record, its template, slots and components, and how a page is rendered.
  • Page Templates — Create page templates as Blade files in resources/views/wrangler/pages, with regions for page builder blocks.
  • Page Components — Create page components (blocks): the PHP class, its Blade views, the editor setup and previews.
  • Collections — Use collections to define custom post types such as blogs, news or events, and show them on pages.
  • Blade Components — Textstem's Blade components for building forms: inputs, selectors and collectors.
  • Admin UI — The building blocks of Textstem's admin: form widgets, data tables, dashboards, tools and ways to extend admin pages.
  • Creating Modules — Modules add admin sections for content that doesn't fit pages or posts, such as subscribers, shows or products.
  • Helpers — The facades and helper classes in the Textstem package, for text, dates, lists, files, images and more.
  • Authorisation — How authorisation works: roles and permissions with spatie/laravel-permission, gates, policies and the super-admin bypass.
  • Localization — Translate Textstem with Laravel translation files. The admin ships in English, Greek, Italian and Japanese.
  • Globals — Read globals in code and templates, and create new global types.
  • Queues — Which Textstem jobs run on queues, the settings that control them, and how to run workers.
  • Scheduled Tasks — The housekeeping tasks Textstem schedules itself, and how to run Laravel's scheduler for them.
  • Search — Textstem's two search mechanisms: the built-in admin search, and Laravel Scout for site search on pages and posts.
  • Broadcasting — How Textstem broadcasts model and AI-job events over WebSockets, and how to set it up.
  • Content Approval — Editors who can't publish send drafts to a publisher, who approves, schedules or returns them, with every step recorded.
  • React Rendering — Optionally render public pages with React through Inertia, while the admin stays Blade and Livewire.
  • Optional Modules — The Textstem features that are off until a site turns them on, and what each one needs.
  • Textstem AI — How Textstem uses AI for content and site checks, all through one service.
  • API — Reference for the Textstem REST API: authentication, endpoints, and request and response formats.
  • Artisan Commands — Every Artisan command the Textstem package registers, from setup and scaffolding to maintenance.
esc