Search by

akrbdk / php-mvc-framework-core

okarabudka

There is no license information available for the latest version (v1.0.6) of this package.

Package info

github.com/okarabudka/php-mvc-framework-core

pkg:composer/akrbdk/php-mvc-framework-core

Statistics

Installs: 24

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.6 2023-05-18 20:05 UTC

This package is auto-updated.

Last update: 2026-11-17 15:58:04 UTC


README

A minimal, self-written PHP MVC framework core distributed as a Composer package.

Context

Learning project built in May 2023. The framework code was first written inside the php-mvc-framework application and then extracted into this reusable library, which is published on Packagist as akrbdk/php-mvc-framework-core.

Not tested in production. Use it at your own risk.

Features

  • Application container with a static instance, request lifecycle and event listeners (beforeRequest, afterRequest)
  • Router with GET and POST routes and controller/action callbacks
  • Request and Response wrappers
  • Controller base class with layouts and middleware registration
  • AuthMiddleware that restricts actions to logged-in users
  • Model with rule-based validation: required, email, min, max, match, unique
  • DbModel / UserModel with save() and findOne() on top of PDO
  • Database with a simple migration runner that tracks applied migrations
  • Session with flash messages
  • View that renders templates inside layouts
  • Form helpers (Form, InputField, TextareaField) that output Bootstrap-style markup with validation errors
  • NotFoundException and ForbiddenException

Tech stack

  • PHP (no runtime dependencies in composer.json; the demo application targets PHP 8.1)
  • PDO
  • Composer, PSR-4 autoloading

Architecture

  • Classic MVC with a front controller: the application creates Application, registers routes and calls run().
  • Global access to services through Application::$app (router, request, response, session, view, db, current user).
  • Active-record style models: a model defines tableName(), attributes() and primaryKey(), DbModel builds the SQL.
  • Sub-namespaces: db/ (database and models), form/ (form rendering), middlewares/, exception/.
  • Namespace: Akrbdk\PhpMvcCore.

Getting started

composer require akrbdk/php-mvc-framework-core

See php-mvc-framework for a complete application that uses this package.

Testing

There are no automated tests.

Status

Finished learning project (2023), not maintained.

License

MIT, see LICENSE.