arout/rhapsody-core

The engine components for the Rhapsody Framework

Maintainers

Package info

github.com/arout77/rhapsody-core

Language:Twig

pkg:composer/arout/rhapsody-core

Transparency log

Statistics

Installs: 54

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

1.10.4 2026-07-02 15:14 UTC

README

The architectural engine and core component library for the Rhapsody MVC Framework. This package provides the underlying routing pipelines, dependency injection container, base controllers, base models, database wrapper utilities, and the CLI scaffolding system.

Features

  • Custom Service Container: Lightweight, fast Dependency Injection container with automatic autowiring.
  • Robust Scaffolding CLI: Easily generate controllers, models, middleware, events, and listeners mapped directly to your active workspace.
  • Flexible Engine Pipelines: Dynamic routing engine decoupled from presentation views.
  • Twig Template Engine Integration: Native support for template rendering out of the box.

Requirements

  • PHP: ^8.1 or higher
  • Extensions: PDO, mbstring, openssl
  • Composer for dependency management

Installation

Since rhapsody-core is distributed as a package, install it via Composer into your application workspace:

composer require arout/rhapsody-core

Directory Architecture

The internal package structure organizes assets cleanly away from application code (for brevity, not all files/directories shown below):

rhapsody-core/
├── bin/
│   └── rhapsody            # Core binary loop entry-point
├── resources/
│   └── stubs/              # Code generation templates (.stub)
└── src/
    ├── Commands/           # CLI Console Command Classes
    ├── Controllers/        # Core Built-in Engine Controllers
    ├── Routing/            # HTTP Request Router and Pipelines
    ├── BaseModel.php       # Base Model Class
    ├── BaseController.php  # Base Controller Class
    ├── Container.php       # Dependency Injection System
    └── Database.php        # PDO Singleton Connection Wrapper

CLI Scaffolding Engine

Rhapsody comes with a powerful command-line helper. To see all available commands, run the following from your application root directory:

php rhapsody

Generation Commands

Scaffolding commands automatically resolve target output destinations relative to your active application workspace root (/app/), while reading templates from the framework package resources:

Generate a Controller:

php rhapsody make:controller HomeController

Generate a Model:

php rhapsody make:model User

Generate Middleware:

php rhapsody make:middleware CheckIfAdmin

Generate Event:

php rhapsody make:event OrderShipped

Generate Listener:

php rhapsody make:listener SendOrderNotification

Maintenance Commands

Flush Caches: Invalidates OPcache and purges compiled Twig template caches.

php rhapsody cache:clear

Warm Up Template Cache: Compiles all .twig files located inside your template theme directory (/views/themes/default/) ahead of time for maximized production response performance.

php rhapsody app:cache-warm

Sync Environments: Appends new configuration tracking variables from .env.example into your local active .env target without destroying current assignments.

php rhapsody env:sync

Extending Stubs

If you wish to customize how classes are generated by default, you can override core layout templates by creating a stubs directory in your application root workspace and dropping custom layout variants matching your framework expectations inside:

/stubs/controller.stub

/stubs/model.stub

/stubs/middleware.stub

/stubs/event.stub

/stubs/listener.stub

The generator utilities will automatically scan for application-level file variants before falling back to vendor package resources.

This software is provided with an MIT license.