PHPackages                             obsidian-moon/engine - 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. obsidian-moon/engine

ActiveLibrary[Framework](/categories/framework)

obsidian-moon/engine
====================

An Open Source, Lightweight and 100% Modular Framework in PHP

2.1.0(3y ago)23021MITPHPPHP &gt;=8.1

Since Aug 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/obsidian-moon/engine)[ Packagist](https://packagist.org/packages/obsidian-moon/engine)[ Docs](https://github.com/obsidian-moon/engine)[ RSS](/packages/obsidian-moon-engine/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (18)Used By (1)

Obsidian Moon Engine
====================

[](#obsidian-moon-engine)

This is a project that I have worked on for several years after wanting a completely modular framework. I am aiming for lightweight and able to include any modules from other applications, etc.

Installing Obsidian Moon Engine
-------------------------------

[](#installing-obsidian-moon-engine)

Since Obsidian Moon Engine uses [Composer](https://getcomposer.org/) you will need to install it before you can run the code with it. Once you have installed Composer you will then be able to install it by running the following command:

```
composer require obsidian-moon/engine
```

Alternatively, you can install the [Obsidian Moon Framework](https://github.com/obsidian-moon/framework/) with a prebuilt structure, by using the following command. Click the link for additional information.

```
composer create-project obsidian-moon/framework
```

Implelementation
----------------

[](#implelementation)

To see a complete implementation of these features review the [common.php](https://github.com/obsidian-moon/framework/blob/master/common.php) file from the [Obsidian Moon Framework](https://github.com/obsidian-moon/framework/). However, below are expanded examples which you can read to see all the optional features in use.

### Controllers

[](#controllers)

Controllers are simple classes that hold methods that can be called from the `ControllerHandler` class. You can extend the builtin abstract class `AbstractController` and pass it your views folder configuration, as follows:

```
// app/Controllers/LandingController.php
class LandingController extends AbstractController
{
    /**
     * Required: Pass the `views` folder configuration to the abstract parent class.
     * Optional: Pass a set of default values which will be handed off to `ViewHandler`
     */
    public function __construct()
    {
        /**
         * Retrieve default data from database/session or declare statically...
         */
        $optionalDefaultValues = [
            'defaultKey1' => 'defaultValue1',
            'defaultKey2' => 'defaultValue2',
            // ...
        ];
        parent::__construct(viewsRoot: VIEWS_ROOT, viewData: $optionalDefaultValues);
    }
}
```

### Controller Handler

[](#controller-handler)

In your application, you can pass information regarding your controller from `symfony/routing` or by passing an array with `_controller` declared. It will return a Symfony Response once the `ControllerHandler::render()` method is called, and it has found the class and method declared:

```
use ObsidianMoon\Engine\Handlers\ControllerHandler;
use ObsidianMoon\Framework\Controllers\LandingController;
use ObsidianMoon\Engine\Exceptions\FileNotFoundException;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;

/**
 * Needs an array containing the following keys `_controller` as follows
 * For Symfony Routing, Replace array with: $matcher->match($request->getPathInfo())
 *
 * Throws FileNotFoundException, Symfony's ResourceNotFoundException, or Symfony's MethodNotAllowedException on error.
 */
try {
    $controller = new ControllerHandler(controller: ['_controller' => [LandingController::class, 'index']]);
    $response = $controller->render(); // Returns Symfony Responce object
} catch (FileNotFoundException | ResourceNotFoundException) {
    // Unable to find that file or route is undefined.
    $response = 'We could not find that page!';
} catch (MethodNotAllowedException) {
    // Sent because of unsupported method, e.g. `$_POST` instead of `$_GET`.
    $response = 'We are unable to process your request. Please try again!';
}
```

### Exception Handler

[](#exception-handler)

You can utilize the use of a custom Exception Handler to handle whether the error message is shown or a custom error is. You can do so as follows:

```
use ObsidianMoon\Engine\Exceptions\FileNotFoundException;
use ObsidianMoon\Engine\Handlers\ExceptionHandler;

/**
 * Setting `admin` to `false` will return the message we pass to `handle()` method. Otherwise, it will return the
 * message originally sent from initial exception.
 */
$exceptions = new ExceptionHandler(admin: false);

/** Useful in conjunction with the `ControllerHandler`. */
try {
    throw new FileNotFoundException('More detailed message for admins');
} catch (FileNotFoundException $e) {
    $message = $exceptions->handle($e, 'A public error message for non-admins and/or production');
}
```

### View Handler

[](#view-handler)

The view handler will look for the location it is passed and find a file with the name that is declared and can return its value, or store it in the output property for later use. There are various ways it can be used, but the most common is as follows:

```
use ObsidianMoon\Engine\Exceptions\FileNotFoundException;
use ObsidianMoon\Engine\Handlers\ViewHandler;

/** Optional default data that can be pulled from DB, session, or static variables to be used in the views. */
$optionalDefaultData = [
    'defaultKey1' => 'defaultValue1',
    'defaultKey2' => 'defaultValue2',
    // ...
];

try {
    /** Instantiate with VIEWS_ROOT constant set to `src/views` and prepare to make calls */
    $view = new ViewHandler(viewsRoot: VIEWS_ROOT, viewData: $optionalDefaultData);

    /** Load a view `src/views/landing/index.php`, pass it data, and return output to a variable */
    $landingContent = $view->load(view: 'landing/index', data: ['key1' => 'value1'], return: true)

    /** Take the landing content and insert it as a variable into `src/views/layouts/shell.php` */
    $view->load(view: 'layouts/shell', data: compact('landingContent'));

    /** Render the content that has been stored in the handler output. */
    $view->render();
} catch (FileNotFoundException $e) {
    // Did not find the file, handle the 404 here.
}
```

[Complete List of Changes](CHANGELOG.md)

Credits
-------

[](#credits)

Obsidian Moon Engine uses the following libraries and projects in its development:

- [PHP 8](https://www.php.net/) with [Composer](https://getcomposer.org/) package manager.
- [Symfony 6 Components](https://symfony.com/components) for HTTP Requests and Routing.

Summary of Obsidian Moon Engine
-------------------------------

[](#summary-of-obsidian-moon-engine)

Most of the code for this is meant to keep it as modular as possible. With version `1.x` I found that I ended up having to repeat a lot of the code because of how routing was unable to be handled automatically. Using symfony routes components ended up solving that issue. However, I was forced to rewrite the code to where it was simpler. I hope that you find this code as useful as I have. And, I will continue to add to it as I expand it with my projects.

Regards,
Alfonso Martinez
Obsidian Moon Development

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 99.5% 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 ~201 days

Recently: every ~423 days

Total

16

Last Release

1310d ago

Major Versions

1.7.2 → 2.0.02022-01-05

PHP version history (6 changes)1.3.0PHP &gt;=5.4.0

1.4.0PHP &gt;=5.5.0

1.5.0PHP &gt;=7.0.0

1.7.0PHP &gt;=7.1.0

1.7.1PHP &gt;=7.2.0

2.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4318946?v=4)[Obsidian Moon Development](/maintainers/obsidian-moon)[@obsidian-moon](https://github.com/obsidian-moon)

---

Top Contributors

[![opensaurusrex](https://avatars.githubusercontent.com/u/251690?v=4)](https://github.com/opensaurusrex "opensaurusrex (200 commits)")[![advocaite](https://avatars.githubusercontent.com/u/1046149?v=4)](https://github.com/advocaite "advocaite (1 commits)")

---

Tags

framework

### Embed Badge

![Health badge](/badges/obsidian-moon-engine/health.svg)

```
[![Health](https://phpackages.com/badges/obsidian-moon-engine/health.svg)](https://phpackages.com/packages/obsidian-moon-engine)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k251.7M11.6k](/packages/symfony-framework-bundle)[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)[pimcore/pimcore

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

3.8k3.8M507](/packages/pimcore-pimcore)[drupal/core-recommended

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

6942.5M421](/packages/drupal-core-recommended)

PHPackages © 2026

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