PHPackages                             cmouleyre/lunacms - 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. cmouleyre/lunacms

ActiveLibrary

cmouleyre/lunacms
=================

LunaCMS is a lightweight and high-performance content management system.

1.0.14(1y ago)128MITPHPPHP &gt;=8.0

Since Sep 21Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/MrManchot/lunacms)[ Packagist](https://packagist.org/packages/cmouleyre/lunacms)[ Docs](https://github.com/MrManchot/lunacms)[ RSS](/packages/cmouleyre-lunacms/feed)WikiDiscussions main Synced 1mo ago

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

LunaCMS - README
================

[](#lunacms---readme)

Overview
--------

[](#overview)

LunaCMS is a lightweight and extensible PHP library for building content management system (CMS) websites. It leverages modern PHP components such as Twig for templating, Doctrine DBAL for database interactions, PHPMailer for email handling, and Redis for optional caching. LunaCMS is designed to help developers create modular, maintainable, and flexible small to medium-scale websites quickly and efficiently.

Features
--------

[](#features)

- **MVC Architecture**: Implements the Model-View-Controller pattern for clear separation of logic, presentation, and data.
- **Twig Templating**: Offers a powerful and flexible templating engine for building dynamic web pages.
- **Site Structure Generation**: Automates the creation of the site structure using the `SiteGenerator` command-line tool.
- **Database Management**: Uses Doctrine DBAL for handling database connections and queries.
- **Email Integration**: Built-in support for sending emails using PHPMailer.
- **Routing System**: A simplified routing system for handling HTTP requests and mapping them to controllers.
- **Redis Integration**: Optional support for Redis caching to enhance performance.
- **Asset Management**: Uses Gulp to compile SCSS and JavaScript assets for efficient delivery.

Requirements
------------

[](#requirements)

- **PHP**: 7.4 or higher
- **Composer**: For managing PHP dependencies
- **Node.js and npm**: For Gulp and asset management
- **PHP Extensions**:
    - PDO (with MySQL support)
    - cURL
    - PHPMailer
    - (Optional) Redis PHP extension if using Redis caching

Installation
------------

[](#installation)

### Prerequisites

[](#prerequisites)

- **PHP 7.4 or higher**
- **Composer**
- **Node.js and npm**
- **Gulp CLI**: Install globally using: ```
    npm install --global gulp-cli
    ```

### Steps

[](#steps)

1. **Clone the Repository**

    ```
    git clone https://github.com/yourusername/lunacms.git
    ```
2. **Navigate to the Project Directory**

    ```
    cd lunacms
    ```
3. **Install PHP Dependencies**

    ```
    composer install
    ```
4. **Install Node.js Dependencies**

    ```
    npm install
    ```
5. **Generate the Site Structure**Use the CLI script to generate the necessary directories and files.

    ```
    cd vendor/cmouleyre/lunacms/
    php create_site.php /path/to/new/site
    ```
6. **Configure the Project**Edit the `config/config.json` file with your project-specific settings.
7. **Build Assets**

    ```
    npm install gulp sass gulp-sass gulp-uglify gulp-clean-css --save-dev
    gulp
    ```

Usage
-----

[](#usage)

### Generating a New Site Structure

[](#generating-a-new-site-structure)

Use the command-line tool to create a new site structure. This will generate all the necessary directories and configuration files:

```
php create_site.php /path/to/new/site
```

### Configuration

[](#configuration)

LunaCMS uses a configuration file located at `config/config.json`. This file contains:

- **Database Settings**: Configure the database connection (host, user, password, etc.).
- **Mail Server Settings**: For PHPMailer integration.
- **Site Information**: Such as the base URL and site name.
- **Debug Settings**: Enable or disable debug mode.

### Controllers

[](#controllers)

LunaCMS follows an MVC architecture, using controllers to handle requests. Create new controllers by extending the `Controller` class:

```
namespace App\Controllers;

use LunaCMS\Controller;

class MyCustomController extends Controller
{
    public function dataAssignment(): void
    {
        $this->template = 'custom_template';
        $this->addVar('meta_title', 'Custom Page Title');
        $this->addVar('meta_description', 'Custom Page Description');
    }
}
```

### Redis Caching

[](#redis-caching)

LunaCMS supports Redis caching if the Redis PHP extension is installed. Example usage:

- **Set a value in Redis**: ```
    $this->setRedisValue('key', 'value', $ttl);
    ```
- **Get a value from Redis**: ```
    $value = $this->getRedisValue('key');
    ```

If Redis is not available, these methods will fail silently.

### Sending Emails

[](#sending-emails)

You can send emails with PHPMailer using LunaCMS's built-in functionality:

```
$this->sendEmail('recipient@example.com', 'Recipient Name', 'Subject', 'HTML Body', 'Plain Text Alternative');
```

Make sure to configure the email settings in the `config/config.json` file.

Routing
-------

[](#routing)

Routing in LunaCMS is handled by the `Routing` class. Define your routes in `config/routes.php`:

```
use App\Controllers\PageController;

return [
    '' => PageController::class,
    '{slug}' => PageController::class,
];
```

This allows you to map URLs to specific controllers easily.

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

[](#project-structure)

```
/your-project
│
├── assets
│   ├── js
│   │   └── script.js
│   └── scss
│       └── main.scss
│
├── cache
│   └── twig
│
├── config
│   ├── config.json
│   └── routes.php
│
├── public
│   ├── css
│   ├── js
│   ├── img
│   └── index.php
│
├── src
│   └── Controllers
│       └── PageController.php
│
├── templates
│   ├── includes
│   │   └── base.twig
│   └── index.twig
│
├── vendor
│
└── gulpfile.js

```

### Key Directories and Files

[](#key-directories-and-files)

- **assets/**: Contains JavaScript and SCSS source files.
- **cache/twig/**: Stores cached Twig templates. Ensure this directory is writable.
- **config/**: Configuration files.
    - **config.json**: Main configuration file.
    - **routes.php**: Defines the application routes.
- **public/**: The web root directory.
    - **index.php**: The application entry point.
    - **css/**, **js/**, **img/**: Compiled assets.
- **src/Controllers/**: Controller classes.
    - **PageController.php**: Example controller.
- **templates/**: Contains Twig templates.
    - **includes/base.twig**: Base template for reusability.
    - **index.twig**: Example page template.
- **vendor/**: Composer dependencies.
- **gulpfile.js**: Gulp configuration for asset compilation.

License
-------

[](#license)

LunaCMS is open source and licensed under the MIT License. You are free to use, modify, and distribute it in accordance with the license terms.

Contributing
------------

[](#contributing)

Contributions are welcome! If you'd like to contribute, please fork the repository and submit a pull request with your changes.

Feel free to reach out if you need more guidance or if anything is unclear.

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance56

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~12 days

Recently: every ~20 days

Total

16

Last Release

413d ago

Major Versions

1.0.13 → v2.x-dev2025-03-18

PHP version history (2 changes)1.0.1PHP &gt;=7.4

1.0.2PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/31999b3179ed3f97c652767c97b1706586dd798caa4d12acd49ce429542df707?d=identicon)[MrManchot](/maintainers/MrManchot)

---

Top Contributors

[![MrManchot](https://avatars.githubusercontent.com/u/2027380?v=4)](https://github.com/MrManchot "MrManchot (30 commits)")

---

Tags

phpcmscontent managementlunacms

### Embed Badge

![Health badge](/badges/cmouleyre-lunacms/health.svg)

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

###  Alternatives

[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M151](/packages/sulu-sulu)[picocms/pico

Pico is a flat file CMS, this means there is no administration backend and database to deal with. You simply create .md files in the "content" folder and that becomes a page.

3.9k37.8k11](/packages/picocms-pico)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[october/rain

October Rain Library

1601.7M63](/packages/october-rain)[bacula-web/bacula-web

The open source web based reporting and monitoring tool for Bacula

1537.5k](/packages/bacula-web-bacula-web)[concrete5/core

Concrete core subtree split

19159.3k48](/packages/concrete5-core)

PHPackages © 2026

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