PHPackages                             silverengine/framework - 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. silverengine/framework

ActiveProject[Framework](/categories/framework)

silverengine/framework
======================

SilverEngine — a lightweight, dependency-light PHP 8.5 MVC framework.

v1.1.0(1mo ago)213417[1 issues](https://github.com/SilverEngine/Framework/issues)MITPHPPHP &gt;=8.4CI failing

Since Jan 3Pushed 1mo ago11 watchersCompare

[ Source](https://github.com/SilverEngine/Framework)[ Packagist](https://packagist.org/packages/silverengine/framework)[ RSS](/packages/silverengine-framework/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (8)Dependencies (7)Versions (20)Used By (0)

SilverEngine Framework
======================

[](#silverengine-framework)

A lightweight PHP **DMVC** framework — *Dynamical Model View Controller* — modernized for **PHP 8.5+** and dependency-light.

[![PHP 8.5+](https://camo.githubusercontent.com/cebcd67c96db8acc6d2476fbc1ecbebec9310416892c81d7e2104ab8b0b4d64c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e352532422d3737374242342e7376673f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/cebcd67c96db8acc6d2476fbc1ecbebec9310416892c81d7e2104ab8b0b4d64c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e352532422d3737374242342e7376673f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)[![DMVC](https://camo.githubusercontent.com/5c2acfa00881ae875275fab1da2a76b42562e8d5a59c6d9e4099f6476d854e3b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6172636869746563747572652d444d56432d626c75652e737667)](https://camo.githubusercontent.com/5c2acfa00881ae875275fab1da2a76b42562e8d5a59c6d9e4099f6476d854e3b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6172636869746563747572652d444d56432d626c75652e737667)[![Runtime deps 2](https://camo.githubusercontent.com/988b095208596b9bb6cd8c5413e205364c2c183535f71b9b51b5f308482f63b9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f72756e74696d65253230646570732d322d737563636573732e737667)](https://camo.githubusercontent.com/988b095208596b9bb6cd8c5413e205364c2c183535f71b9b51b5f308482f63b9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f72756e74696d65253230646570732d322d737563636573732e737667)[![License MIT](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)[![Status](https://camo.githubusercontent.com/28ecfa2bbb4e8eb5c5ee3941676ddebac20b336c2f4a7b9e70429aa53ce39288/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374617475732d6d6f6465726e697a65642d626c75652e737667)](https://camo.githubusercontent.com/28ecfa2bbb4e8eb5c5ee3941676ddebac20b336c2f4a7b9e70429aa53ce39288/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374617475732d6d6f6465726e697a65642d626c75652e737667)

> **Two tiny runtime deps, build-time-only frontend, framework code in the repo.** Composer is used **only** as the autoloader — `silverengine/core`ships as a local Composer `path` package under `packages/`, never pulled from Packagist. The only Packagist runtime requires are `vlucas/phpdotenv` and `nejcc/php-datatypes`.

SilverEngine is a **D**ynamical **M**odel **V**iew **C**ontroller framework: routing, a fluent query builder + Model, the Ghost template engine, server-driven Vue (Wisp), middleware, an IoC container with autowiring, a code-generation CLI, a built-in debug profiler with a request recorder, and `optimize` / `optimize:clear` cache commands.

---

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

[](#requirements)

- PHP **8.5+**
- Composer 2.x (autoloading only — no network access required for framework code)
- PHP extensions: `pdo_sqlite` (bundled with PHP) for the default database
- Node 20+ / npm — **build-time only**, for the Wisp frontend toolchain

Quick start
-----------

[](#quick-start)

```
git clone git@github.com:SilverEngine/Framework.git
cd Framework

# Composer is used purely as the autoloader. silverengine/core is
# resolved from a local path repository; nothing framework-related is
# downloaded from Packagist.
composer install

# Start the built-in dev server on the public/ docroot
php silver serve
```

Open  — you should see the welcome page. Stop the server with `Ctrl+C`.

For frontend work (Wisp / Vue with HMR), run the full dev stack:

```
npm install
composer dev          # PHP server + Vite, concurrently
npm run build         # type-check + production assets → public/build/
```

For production, point your Apache / nginx docroot at `public/`. The shipped `.htaccess` front-controller works out of the box; the router also resolves correctly under nginx `try_files` and the PHP built-in server.

The `silver` CLI
----------------

[](#the-silver-cli)

```
php silver help                       # full command reference
php silver serve [host:port]          # dev server (default 127.0.0.1:8000)
php silver migrate                    # run database/Migrations

php silver optimize                   # cache merged config + routes,
                                      #   run composer dump-autoload -o
php silver optimize:clear             # clear those caches

php silver g resource           # controller + model + view + routes
php silver g controller
php silver g model
php silver g view
php silver g facade
php silver g helper
php silver d resource           # delete a CRUD resource
```

`serve` accepts a bare port (`php silver serve 8080`) or a full `host:port` (`php silver serve 0.0.0.0:8080`).

After editing `.env`, a `config/` override, or a route file, run `php silver optimize:clear` (or `optimize` to rebuild).

Routing
-------

[](#routing)

`config/Routes.php` is an ordered list of route files to include — the first entry is the core system routes (inside the package); your routes follow:

```
// app/Routes/Web.php
Route::get('/',     'Welcome@welcome', 'home');
Route::get('/demo', 'Welcome@demo',    'demo');

// app/Routes/Api.php
Route::group(['prefix' => 'api'], function () {
    Route::get('/widgets', 'Widgets@list');
});
```

Unknown routes return a proper **404** (rendered by the `ErrorHandler`middleware → `app/Views/errors/404`). Uncaught exceptions render a **self-contained** 500 page (inline CSS — never breaks even if the asset build is broken). API requests (`/api/…`) get a JSON error envelope:

```
{ "error": { "status": 500, "message": "…",
             "exception": "App\\…", "file": "…", "line": 42, "trace": [ … ] } }
```

In production, only `status` + `message` are returned — class, file, line and trace are debug-only.

Frontend — Wisp (server-driven Vue)
-----------------------------------

[](#frontend--wisp-server-driven-vue)

An Inertia-style stack baked into Ghost: **Vite + Vue 3 + TypeScript + Tailwind 4** with the official `@inertiajs/vue3` client. Controllers return `wisp('Page', $props)` instead of a Ghost view; Ghost renders the app shell on full loads and the page object as JSON on client navigations. No client router, no separate API layer.

```
public function welcome(): mixed
{
    return wisp('Welcome', ['name' => 'World']);
}
```

Every Wisp page is wrapped in a **persistent default layout**(`app/Resources/js/Layouts/Layout.vue`) — opt out per page with `defineOptions({ layout: null })` or supply your own. Classic Ghost `.ghost.tpl` rendering still works and coexists (`/`, errors, `/demo`).

Container &amp; dependency injection
------------------------------------

[](#container--dependency-injection)

`Silver\Core\Container` is a real IoC container:

```
$c = \Silver\Core\App::instance()->instances();

$c->bind(MailerInterface::class, SmtpMailer::class);
$c->singleton(Clock::class, fn () => new SystemClock());

// Controllers and middleware get constructor injection automatically:
class UserController
{
    public function __construct(private UserRepo $repo) {}
}
```

`Container` also exposes the legacy registry surface (`register`/`registerNamed`/`get`/`getAll`) for backwards compatibility with code written before the IoC rework.

Database
--------

[](#database)

The default connection is **SQLite**, configured via `.env`:

```
DB_CONNECTION=sqlite
DB_DATABASE=database/db.sqlite   # auto-created on first connect, git-ignored
```

Switch the driver to `mysql` / `pgsql` (and fill in host / database / username / password) to use those — the DSN is built per-driver. The query runtime is split into a small `ConnectionManager` (registry + lazy PDO), a `TransactionManager` (nested `BEGIN/COMMIT/ROLLBACK` with savepoints), and `Db` as a thin backward-compatible facade. Per-driver SQL variance is resolved by a typed `Dialect` strategy + a `DbDriver` / `QueryType` enum.

Config — defaults in core, overrides in your app
------------------------------------------------

[](#config--defaults-in-core-overrides-in-your-app)

Framework config defaults live in `packages/silverengine/core/src/Config/`. Your `config/` directory is an **overrides overlay** that **deep-merges**over them:

```
// packages/silverengine/core/src/Config/Recorder.php (default)
return ['enabled' => true, 'limit' => 50, 'ignore' => ['/debug', '…']];

// config/Recorder.php (your override)
return ['limit' => 200];

// effective: ['enabled' => true, 'limit' => 200, 'ignore' => ['/debug', '…']]
```

Associative arrays merge recursively (your keys win); a list or scalar override replaces wholesale. See `config/README.md` for the full rules.

Debug — timeline + request recorder
-----------------------------------

[](#debug--timeline--request-recorder)

When `APP_DEBUG=true`, every request's full lifecycle is timed (autoload → Env → DB connect → load routes/middlewares → request → per-middleware → controller resolve / action → view render → response sent) and persisted to `storage/debug/recordings/` (file-based, ring-buffered). Browse to `/debug` to see:

- **Overview** — request, environment, DB, packages
- **Timeline** — colored waterfall of the current request
- **Recordings** — list of recent requests; click any to replay its *complete* lifecycle in the waterfall (incl. phases the live page can't show about itself)

`/debug`, `/build`, `/favicon`, `/robots` are excluded from recording by default; override `recorder.ignore` in `config/Recorder.php`.

Tests
-----

[](#tests)

PHPUnit 12 ships as `require-dev` (dev-only — runtime stays dependency-light):

```
composer test            # phpunit
vendor/bin/phpunit       # equivalent
```

The suite lives in `tests/Unit/**Test.php`.

Project structure
-----------------

[](#project-structure)

```
app/            Your application
  Controllers/  Models/  Views/  Routes/  Middlewares/  Facades/
  Resources/    js (Layouts/, Pages/, app.ts), css (app.css), views (Wisp shell)
packages/       First-party local Composer path package
  silverengine/core   Framework core (namespace Silver\)
    src/Config/       Framework config DEFAULTS
config/         Your config OVERRIDES (deep-merged over the defaults)
database/       Migrations/  Seeds/  (db.sqlite — git-ignored)
storage/        Logs/  debug/recordings/  cache/  (all git-ignored)
public/         Web docroot — index.php + .htaccess; build/ assets
tests/          PHPUnit suite (Unit/)
silver          CLI entry point
.env            Environment configuration (APP_DEBUG, DB_*, …)

```

Architecture notes
------------------

[](#architecture-notes)

- **Composer pulls nothing from Packagist for the framework itself.**`silverengine/core` is resolved from a local `path` repository in `packages/`. Runtime depends only on `vlucas/phpdotenv` and `nejcc/php-datatypes`.
- **Error reporting** is the first-party `Silver\ErrorHandler\Reporter`, inlined in `silverengine/core`. Fatal-class errors halt and render a self-contained debug page; warnings, notices and deprecations are logged but do not break the request.
- **Error pages** (`500`, `404`) are fully self-contained (inline CSS) — they render even if the asset build, the database or the rest of the app is broken. In debug they show the real exception class, message, file/line, request context (method/URI/route/IP/query/input), source snippet and a normalized stack trace.
- **Frontend dependencies** (Vite/Vue/Tailwind) are **build-time only**.
- **Production tip:** run `php silver optimize` after deploys; ensure PHP has **opcache** enabled (the dominant runtime lever). Do **not** use Composer's `--classmap-authoritative` — the framework relies on dynamic class resolution that an authoritative classmap would break.

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

[](#contributing)

Contributions are welcome. Please keep to:

1. The existing directory structure
2. PSR-4 autoloading, PSR-12 style
3. Framework classes under the `Silver\` namespace; app code under `App\`(directories lowercased, namespaces PascalCase)
4. PHP 8.5+ idioms — `declare(strict_types=1)`, typed/readonly properties, constructor promotion, `match`, enums for finite sets, `final` on leaf classes
5. Tests for behavioural changes — `tests/Unit/Framework/...`

Special thanks to past contributors: [lotfio-lakehal](https://github.com/lotfio), [nmarulo](https://github.com/nmarulo), [antigov](https://github.com/antigov), [mawaishanif](https://github.com/mawaishanif).

Security
--------

[](#security)

If you discover a security vulnerability, please email **** rather than opening a public issue.

License
-------

[](#license)

Open-source software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

59

—

FairBetter than 98% of packages

Maintenance92

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity89

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 71.7% 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 ~510 days

Recently: every ~765 days

Total

7

Last Release

34d ago

PHP version history (2 changes)v1.0.6PHP &gt;=8.1

v1.1.0PHP &gt;=8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e72674f3996339810fecca431793ab66131a38880760fa342ac5e2b61432ed4?d=identicon)[SilverEngineTeam](/maintainers/SilverEngineTeam)

---

Top Contributors

[![Nejcc](https://avatars.githubusercontent.com/u/6236128?v=4)](https://github.com/Nejcc "Nejcc (170 commits)")[![SilverEngineTeam](https://avatars.githubusercontent.com/u/16226867?v=4)](https://github.com/SilverEngineTeam "SilverEngineTeam (53 commits)")[![KingSiller](https://avatars.githubusercontent.com/u/7824645?v=4)](https://github.com/KingSiller "KingSiller (5 commits)")[![jadonbrownza](https://avatars.githubusercontent.com/u/7773361?v=4)](https://github.com/jadonbrownza "jadonbrownza (2 commits)")[![nejcdev](https://avatars.githubusercontent.com/u/66303179?v=4)](https://github.com/nejcdev "nejcdev (2 commits)")[![EvilFreelancer](https://avatars.githubusercontent.com/u/9089568?v=4)](https://github.com/EvilFreelancer "EvilFreelancer (2 commits)")[![nmarulo](https://avatars.githubusercontent.com/u/3668825?v=4)](https://github.com/nmarulo "nmarulo (1 commits)")[![oversoul](https://avatars.githubusercontent.com/u/2866351?v=4)](https://github.com/oversoul "oversoul (1 commits)")[![lotfio](https://avatars.githubusercontent.com/u/18489496?v=4)](https://github.com/lotfio "lotfio (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/silverengine-framework/health.svg)

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

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k104.3M836](/packages/laravel-socialite)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k38.6M289](/packages/laravel-dusk)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

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