thephprame/thephprame-core

Core of the phprame framework

Maintainers

Package info

github.com/ThePHPrame/thephprame-core

pkg:composer/thephprame/thephprame-core

Statistics

Installs: 22

Dependents: 2

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.6 2026-01-28 20:21 UTC

This package is not auto-updated.

Last update: 2026-03-25 21:09:06 UTC


README

Core utilities and base classes for the phprame PHP micro-framework.

This package contains the core building blocks used by thephprame applications: base controller and model classes, HTTP request/response wrappers, routing helpers, middleware base, and lightweight helpers for files, cookies, encryption and database access.

Key Features

  • Minimal, framework-agnostic helpers for small apps
  • Base classes: controllers, models and middleware
  • Request/Response and routing support
  • Small utility helpers: Files, Cookies, Encryption, Database

Installation

If the package is available via Composer (packagist):

composer require thephprame/thephprame-core

For local development (when using this repo as a local package), add a path repository to your application's composer.json and require the package by name:

"repositories": [
  { "type": "path", "url": "../local-packages/thephprhame-core" }
]

Then run composer require thephprame/thephprame-core in your application.

Quick Usage

These examples illustrate common patterns — adapt them to your app structure.

Controllers

Extend the base controller to create action methods used by routes:

class HomeController extends Controller
{
    public function index()
    {
        return Response::view('home', ['name' => 'world']);
    }
}

Models

Create models by extending Model for simple DB interactions:

class User extends Model
{
    protected $table = 'users';
}

$user = (new User())->find(1);

Routing

Register routes using the Routes helper (see the application's Routes files):

Routes::get('/', [HomeController::class, 'index']);
Routes::post('/api/items', [ItemController::class, 'store']);

Request / Response

Use Request to access input and Response to send responses:

$name = Request::input('name', 'guest');
return Response::json(['hello' => $name]);

Utility Classes (brief)

  • Controller — base controller class
  • Model — base model with simple DB helpers
  • Routes — route registration helpers
  • Request / Response — HTTP wrappers
  • Middleware — base middleware class
  • Database / DatabaseHelper — DB connection and helpers
  • Encryption — encryption utilities
  • File / Files — file helpers
  • Cookie / Cookies — cookie helpers
  • IException — core exception interface

Contributing

Contributions are welcome. Please open issues or pull requests against the repository. Keep changes focused and include tests/examples where appropriate.

License

The package is distributed under the MIT License. See the composer.json for license metadata.

Authors

See composer.json authors field for package authors.