PHPackages                             gemvc/stcms - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. gemvc/stcms

ActiveLibrary[Framework](/categories/framework)

gemvc/stcms
===========

A simple CMS core based on GEMVC.

1.6.2(7mo ago)11581MITTwigPHP &gt;=8.2

Since Jul 6Pushed 7mo agoCompare

[ Source](https://github.com/gemvc/stcms)[ Packagist](https://packagist.org/packages/gemvc/stcms)[ RSS](/packages/gemvc-stcms/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (5)Versions (35)Used By (0)

STCMS - Hybrid PHP/React CMS Library
====================================

[](#stcms---hybrid-phpreact-cms-library)

> 🔴 **CRITICAL FOR AI ASSISTANTS &amp; NEW USERS** 🔴
>
> **You MUST read and learn from [AI\_ONBOARDING.md](./vendor/gemvc/stcms/AI_ONBOARDING.md) before attempting to modify or explain this project.** This file contains the most complete and up-to-date documentation, best practices, and project philosophy. Failure to do so will result in incorrect guidance.

---

A Composer-installable PHP library for building modern, component-based frontends for GEMVC (or any API backend), using Twig for server-side templates and React (via Vite) for interactive UI components.

Features
--------

[](#features)

- 🎯 **Ultra-Clean Architecture**: 8-line `index.php` with perfect Bootstrap encapsulation
- 🚀 **One-Click Environment Switching**: Change `APP_ENV` in `.env` to switch between development/production
- 🌍 **Auto-Language Detection**: No manual configuration - languages auto-detected from `/pages/` structure
- 🔧 **Perfect Bootstrap Class**: All initialization, validation, and app startup handled automatically
- 🚀 **Hybrid Rendering**: Twig for server-side, React for interactive components
- 🔌 **API Integration**: Fetch data from GEMVC or any API using Guzzle
- ⚡ **Modern Caching**: Symfony Cache (APCu/file)
- 🛠️ **Powerful CLI**:
    - `init` command for one-step project scaffolding
    - `install:help` to add full documentation and examples
    - `cache:clear` for easy cache management in production
    - `deploy:init` to set up automated deployment workflows (e.g., GitHub Actions)
- 🎨 **Component-based UI**: React components in `/assets/js/components/`, bundled with Vite
- 🗂️ **Zero-Config Multi-language Support**: Add language folders and the system automatically detects them
- 🗂️ **Zero-Config File-Based Routing**: Predictable routing where the URL path directly maps to a file path
- 🔒 **Config via .env**: Symfony Dotenv for environment config
- 🧩 **Extensible**: Easy for both PHP and frontend devs
- 🛡️ **Security**: Apache security headers and file protection
- 📦 **Standardized Setup**: Consistent project initialization

---

🏗️ **Revolutionary Architecture**
---------------------------------

[](#️-revolutionary-architecture)

### **Ultra-Clean Entry Point**

[](#ultra-clean-entry-point)

```
// public/index.php - Only 8 lines!
require_once __DIR__ . '/../vendor/autoload.php';
use Gemvc\Stcms\Core\Bootstrap;

$projectRoot = dirname(__DIR__);
$bootstrap = new Bootstrap($projectRoot);
$bootstrap->runApp();
```

### **Perfect Bootstrap Encapsulation**

[](#perfect-bootstrap-encapsulation)

- **Automatic Environment Loading**: `.env` file loaded and validated
- **Auto-Language Detection**: Scans `/pages/` directory for supported languages
- **Smart Root URL Handling**: Automatic redirects for clean URLs
- **Complete App Initialization**: TemplateEngine, Router, Application all handled

### **One-Click Environment Switching**

[](#one-click-environment-switching)

```
# .env file
APP_ENV=development  # ← Change this to switch modes
```

- **Development**: Vite dev server, hot reload, debug info
- **Production**: Optimized assets, caching, performance mode

---

Project Structure
-----------------

[](#project-structure)

```
project-root/
├── assets/
│   ├── js/
│   │   ├── app.jsx                # Main React entry point
│   │   ├── registry.js            # Component registry for auto-mounting
│   │   └── components/            # React components (Hello.jsx, UserProfile.jsx, etc.)
│   └── css/
│       └── app.css                # Unified CSS file (Tailwind + custom)
├── pages/
│   ├── en/                        # English pages (auto-detected)
│   ├── fr/                        # French pages (auto-detected)
│   └── index.twig                 # Main landing page (Twig)
├── templates/
│   ├── default.twig               # Base HTML layout (Twig)
│   ├── navbar.twig                # Navigation component
│   └── lang-switch.twig           # Language switcher
├── components/
│   ├── components.twig            # Reusable Twig components (macros)
│   ├── docs_sidebar.twig          # Documentation sidebar
│   └── mermaid.twig               # Mermaid.js chart component
├── public/
│   ├── index.php                  # Ultra-clean entry point (8 lines!)
│   └── assets/build/              # Built assets (from Vite)
├── vendor/
│   └── gemvc/stcms/
│       └── src/Core/
│           ├── Bootstrap.php      # Perfect initialization class
│           ├── Application.php    # Clean request lifecycle
│           ├── TemplateEngine.php # Twig template engine
│           └── MultilingualRouter.php # Auto-language routing
├── vite.config.js                 # Vite config for building frontend assets
├── package.json                   # NPM dependencies and scripts
├── composer.json                  # PHP dependencies
├── .env                           # Environment config (Symfony Dotenv)
├── .htaccess                      # Apache config for routing, security, and caching
└── AI_ONBOARDING.md               # Full AI and user onboarding guide

```

---

How It Works
------------

[](#how-it-works)

### **Hybrid Rendering &amp; Registry-based React Mounting**

[](#hybrid-rendering--registry-based-react-mounting)

- **Twig** renders the main HTML structure and server-side content
- **React** is used for interactive UI components, mounted into specific `` elements
- **Component registry** (`assets/js/registry.js`) maps DOM IDs to React components and prop parsers
- **app.jsx** auto-mounts all registered components to their respective DOM elements
- **Vite** bundles React code for production (`public/assets/build/app.js`)
- **Tailwind CSS** (optional) for styling; **Prism.js** for code highlighting in docs/examples

### **Routing &amp; Security**

[](#routing--security)

- **File-Based Routing**: Maps URL path like `/en/about` directly to `pages/en/about.twig`
- **Centralized .htaccess**: Secure setup that protects sensitive files and routes all requests through the public front-controller
- **Dynamic data** handled via standard GET parameters (`?id=123`), automatically available in templates

---

Philosophy
----------

[](#philosophy)

- **Ultra-clean architecture** with perfect separation of concerns
- **Zero configuration** - just set your environment and start coding
- **Auto-detection** of languages and features
- **One-click environment switching** between development and production
- **Fast, SEO-friendly, and interactive**
- **Works on most hosting** (APCu/file cache)
- **Extensible and maintainable**
- **Security headers and file protection**
- **Modern development workflow**
- **Easy for both PHP and React developers**
- **Standardized setup and CLI project initialization**

---

Getting Started
---------------

[](#getting-started)

1. Install via Composer:

    ```
    composer require gemvc/stcms
    ```
2. Initialize a new minimal project:

    ```
    php vendor/bin/stcms init
    ```
3. Configure your environment in `.env`:

    ```
    APP_ENV=development  # or production
    ```
4. (Optional) Install documentation and example pages for specific languages:

    ```
    # Install English docs
    php vendor/bin/stcms install:help en
    ```
5. (Optional) Set up an automated deployment workflow:

    ```
    # Create a workflow file for GitHub Actions and FTP
    php vendor/bin/stcms deploy:init github-actions-ftp
    ```
6. Install frontend dependencies and build assets:

    ```
    npm install
    npm run build
    ```
7. Start the PHP server:

    ```
    php -S localhost:8000 -t public
    ```
8. **That's it!** Your application is running with:

    - ✅ **Auto-detected languages** from `/pages/` structure
    - ✅ **Perfect Bootstrap initialization**
    - ✅ **Ultra-clean architecture**
    - ✅ **One-click environment switching**
9. **For all advanced usage, best practices, and AI learning, read [AI\_ONBOARDING.md](./AI_ONBOARDING.md).**

---

🎯 **Why STCMS is Revolutionary**
--------------------------------

[](#-why-stcms-is-revolutionary)

**Before STCMS**: Complex configuration, manual setup, bloated entry points **With STCMS**: 8-line entry point, auto-detection, one-click environment switching

**Experience the future of CMS development!**

---

**STCMS** – The expert's choice for hybrid frontends. Build powerful, multilanguage applications with PHP and React in a simple, AI-ready library. 🚀

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance65

Regular maintenance activity

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 72.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Recently: every ~34 days

Total

34

Last Release

212d ago

Major Versions

0.0.1 → 1.0.12025-07-06

PHP version history (2 changes)0.0.1PHP &gt;=8.0

1.5.3PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/e56aef71be22058cb4009cb1ef3b656232c2250df6726d63a812e18fe6f73e3c?d=identicon)[gemvc](/maintainers/gemvc)

---

Top Contributors

[![secure73](https://avatars.githubusercontent.com/u/6285341?v=4)](https://github.com/secure73 "secure73 (45 commits)")[![gemvc](https://avatars.githubusercontent.com/u/211101824?v=4)](https://github.com/gemvc "gemvc (17 commits)")

### Embed Badge

![Health badge](/badges/gemvc-stcms/health.svg)

```
[![Health](https://phpackages.com/badges/gemvc-stcms/health.svg)](https://phpackages.com/packages/gemvc-stcms)
```

###  Alternatives

[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

21866.0M1.7k](/packages/drupal-core)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6942.5M420](/packages/drupal-core-recommended)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M508](/packages/pimcore-pimcore)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
