Craft CMS

A developer-first PHP CMS with clean-slate content modeling, auto-generated GraphQL API, and a four-tier edition system that scales from solo projects to enterprise deployments.

3.6Kstars
703forks
Custom / Unknown
PHP

Craft CMS is a self-hosted PHP content management system built on Yii2, designed for developers and content teams who need complete control over content structure, templating, and delivery. Unlike opinionated platforms that impose predefined content types, Craft starts with a blank slate — you define every field, every content type, and every relationship from scratch, without being forced into a fixed schema.

At its core, Craft’s element system treats all content — entries, assets, users, addresses, categories, and tags — as first-class objects with a shared query interface. This means relationships, search indexing, eager loading, and GraphQL introspection work uniformly across every content type. The built-in GraphQL API is auto-generated from your content model, producing typed queries and mutations without requiring any manual schema configuration.

Craft ships in four editions: Solo for single-user sites, Team for small groups, Pro for multi-user publishing teams with public registration and custom permissions, and Enterprise with SSO provider integration for large organizations. Each tier is enforced at the service level, and all editions run on the same codebase. The ProjectConfig system serializes your entire site schema to YAML, making environment parity and schema versioning straightforward for teams using Git-based workflows.

The plugin ecosystem extends Craft with hundreds of community and official packages, and Craft Commerce adds a fully customizable e-commerce layer built on the same element and field infrastructure — letting developers build product catalogs, checkout flows, and inventory systems with the same modeling tools used for editorial content.

What You Get

  • Custom Fields & Content Modeling - Build any content structure using a library of field types (plain text, rich text, Matrix blocks, relationships, assets, dates, dropdowns, and more) managed centrally and reusable across content types without schema constraints.
  • Auto-Generated GraphQL API - Every content type you define automatically generates typed GraphQL queries and mutations, enabling headless delivery to React, Vue, mobile apps, or any HTTP client without writing a custom API layer.
  • Twig Templating Engine - Use Symfony’s Twig templating to build dynamic, secure, and reusable front-end templates with full control over markup, including template inheritance, macros, and Craft’s custom Twig extensions.
  • Matrix Fields with Nested Entries - Create flexible page-builder-style layouts using Matrix fields that support multiple block types, nested content entries, and card or list views for rich content authoring in the control panel.
  • Multi-Site & Multi-Language Localization - Manage content across unlimited sites, languages, and locales with field-level translation control and locale-specific content variations from a single installation.
  • Live Preview with Shareable URLs - Preview content changes in real time as editors work, and generate shareable preview URLs so stakeholders can review drafts before publication without control panel access.
  • Asset Management with Cloud Storage - Upload and organize files with custom fields and focal-point cropping, storing assets on local disk, Amazon S3, Google Cloud Storage, or Craft Cloud without changing application code.
  • User Management & Granular Permissions - Define roles and permissions per group or user, including public user registration and custom profile fields in Pro, and SSO identity provider integration in Enterprise.
  • ProjectConfig for Schema Versioning - Craft serializes your entire site structure — field layouts, sections, entry types, and more — to YAML files that can be committed to Git and applied deterministically across development, staging, and production environments.
  • Plugin Store with Hundreds of Extensions - Extend Craft with official and community plugins for SEO, e-commerce, analytics, marketing tools, and integrations with services like Mailchimp, Salesforce, and Stripe.
  • Craft Commerce Integration - Build fully customized e-commerce experiences with a native, extensible commerce platform that uses the same element and field infrastructure as the CMS for product catalogs, variants, inventory, and checkout.
  • Four-Tier Edition System - Choose Solo, Team, Pro, or Enterprise — each gating specific features at the service level — so the right capabilities are available without paying for what you don’t need.

Common Use Cases

  • Building a multinational marketing site - A global brand uses Craft’s multi-site and localization features to manage twelve language versions of their site from a single installation, with shared content structures and locale-specific field translations.
  • Developing a headless content platform for a React frontend - A product team uses Craft’s auto-generated GraphQL API to serve structured content to a Next.js frontend, eliminating the need to build and maintain a custom API backend.
  • Running a high-traffic e-commerce store with complex product variants - An online retailer uses Craft Commerce to manage custom product options, regional tax rules, and fulfillment integrations while keeping editorial and catalog content in the same CMS.
  • Powering a publisher’s digital magazine with flexible page layouts - A media company uses Matrix fields to give editors a page-builder experience for articles, embedding video blocks, author bios, and image galleries without fixed templates.
  • Managing enterprise intranet content with SSO - A large organization deploys Craft Enterprise and connects it to their Okta or Azure AD identity provider, giving employees single sign-on access to internal content portals.
  • Deploying a multi-tenant agency platform - A digital agency runs multiple client sites from a single Craft installation using multi-site features, sharing field definitions and content types across client projects while keeping content isolated.

Under The Hood

Architecture Craft CMS is built on a clean layered architecture using Yii2, with clear separation between controllers handling HTTP concerns, dedicated service classes encapsulating business logic, and Active Record models for database persistence. The application’s central innovation is a unified element type system that treats all content — entries, assets, users, addresses, categories, and tags — as first-class objects implementing a common ElementInterface, enabling relationships, search indexing, eager loading, and GraphQL introspection to work uniformly across every content type. An event-driven design with Yii2’s centralized event system enables loose coupling between core subsystems and the plugin ecosystem, so third-party extensions can hook into element lifecycle events, GraphQL schema registration, and ProjectConfig changes without modifying core code. The ProjectConfig subsystem serializes the entire site schema to YAML files, enabling infrastructure-as-code deployment workflows where schema changes are version-controlled and applied deterministically.

Tech Stack The backend runs on PHP 8.2+ with Yii2 as the MVC framework, supplemented by Symfony components for serialization and environment parsing, plus Laravel’s Illuminate Collections for expressive data manipulation. Database access uses Yii2’s Query Builder and Active Record against MySQL or PostgreSQL. The GraphQL API is powered by a Pixel & Tonic fork of webonyx/graphql-php with auto-generating mutation and query builders. The control panel frontend is built with Webpack using a custom @craftcms/webpack preset, Vue 2.6 for interactive components, SCSS for styling, Tailwind CSS for newer UI elements, and Prettier plus Stylelint enforced through Husky pre-commit hooks. Image processing uses the Imagine library with ImageMagick or GD backends. Testing combines Codeception for unit, functional, and acceptance tiers with Playwright for end-to-end browser automation.

Code Quality The codebase demonstrates strong code quality practices throughout. PHP 8.2+ strict type declarations are applied consistently across models, helpers, and service classes, with typed properties and explicit return types reducing runtime errors. The test suite is comprehensive: Codeception covers unit, functional, and acceptance tiers with data providers validating edge cases across element queries, field types, and GraphQL resolvers, while Playwright handles end-to-end browser automation for control panel workflows. Error handling follows Yii2’s typed exception system with domain-specific exception classes for database connectivity, site configuration, and edition mismatches. ECS enforces PHP coding standards and Stylelint enforces frontend CSS conventions, both wired into pre-commit hooks. Service classes are well-named and focused on single domains, though the breadth of the platform means several services are extensive in scope.

What Makes It Unique Craft’s most technically distinctive capability is its ElementQueryConditionBuilder, which analyzes incoming GraphQL query ASTs at runtime to automatically determine which relations require eager loading, preventing N+1 query patterns without requiring developers to specify eager-load hints manually. The ProjectConfig system provides true infrastructure-as-code for CMS schema — sections, entry types, field layouts, and GraphQL schemas are all serialized to YAML and can be applied across environments using a deployment command. The four-tier edition system (Solo, Team, Pro, Enterprise) gates capabilities at the service level using requireEdition() checks, allowing a single codebase to serve single-person blogs through large enterprise deployments with SSO identity providers and extended user limits.

Self-Hosting

Craft CMS uses a custom proprietary license created by Pixel & Tonic, the company behind Craft. The license permits use, modification, and distribution of the software but imposes three meaningful restrictions: each licensed copy may only be actively installed in one production environment at a time, licensing features within the software may not be circumvented, and payment must be made when prompted. This is not an open-source license in the OSI sense — Craft Solo is free to use, while Team, Pro, and Enterprise editions require paid licenses. For self-hosters, this means Craft is source-available but commercially licensed; you can read and modify the code, but you must purchase the appropriate license tier for your deployment and cannot run the same license across multiple production sites without paying for each.

Running Craft yourself requires a PHP 8.2+ web server with extensions including bcmath, curl, dom, intl, mbstring, openssl, pdo, and zip — a standard LAMP or LEMP stack works well. MySQL 8.0+ or PostgreSQL 13+ handles content storage. You are responsible for server provisioning, TLS configuration, database backups, queue workers for background jobs (using a job runner like Supervisor with Redis or database queues), and PHP process management. Craft’s built-in installer and migration system handles upgrades, but applying them to production requires manual intervention or a deployment pipeline. The asset volume system supports local storage, Amazon S3, and Google Cloud Storage, each requiring separate configuration and IAM credentials.

Craft Cloud, the managed hosting option from Pixel & Tonic, eliminates these operational concerns: it handles PHP runtime management, database provisioning, asset storage, CDN delivery, and automated backups. Self-hosters give up managed upgrades, guaranteed uptime SLAs, integrated CDN, and official support response-time guarantees that come with Craft Cloud plans. Enterprise customers also get access to SSO identity provider integration and extended user limits that are not available in lower tiers. For teams without dedicated infrastructure experience, the operational overhead of self-hosting Craft — particularly queue management and image transform performance at scale — should factor into the hosting decision.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack

No spam. Unsubscribe anytime.

Join 750+ subscribers
No spam. Unsubscribe anytime.

Search