Skip to content

webrium/webrium

Repository files navigation

Webrium Framework

Webrium

Fast, Lightweight PHP Framework for Modern Web Applications

Latest Stable Version Total Downloads License

Fast · Modular · Elegant


About Webrium

Webrium is a PHP web application framework built for developers who value simplicity, speed, and clean structure. It provides everything you need to build web applications and REST APIs without unnecessary complexity.

✔ Fast and lightweight
✔ MVC architecture
✔ Powerful routing system
✔ Blade-compatible templating
✔ Built-in database query builder (FoxDB)
✔ Vite + TailwindCSS configured out of the box


Installation

composer create-project webrium/webrium my-app
cd my-app && npm install
npm run dev

Then open your browser at http://localhost:8000


Routing

Webrium's routing API will feel immediately familiar if you've used Laravel.

use Webrium\Route;

Route::get('/', function () {
    return 'Hello, World!';
});

Route::get('/users', 'UserController@index');
Route::post('/users', 'UserController@store');
Route::get('/users/{id}', 'UserController@show');

Route::group(['prefix' => '/api', 'middleware' => 'AuthMiddleware@handle'], function () {
    Route::get('/profile', 'ProfileController@index');
});

Controllers

<?php

namespace App\Controllers;

class UserController
{
    public function index()
    {
        $users = User::all();
        return view('users/index.php', compact('users'));
    }

    public function show($id)
    {
        return view('users/show.php', ['user' => User::find($id)]);
    }

    public function store()
    {
        User::create(input());
        return ['status' => 'created'];
    }
}

Documentation

Documentation is currently being written.
The full docs site is under construction. In the meantime, you can find the available references below.

Getting Started

Topic Description
Views Rendering views and templating syntax: loops, conditions, layouts

Routing & Request

Topic Description
Routing Define routes, groups, middleware, named routes
Helper Functions Global shortcuts: url(), redirect(), input(), respond(), env() and more
URL Utilities Generate and manipulate URLs
Header Management Control HTTP response headers
HTTP Client Make outgoing HTTP requests with a fluent API

Security & Validation

Topic Description
Form Validation Validate and sanitize user input
Hash & Password Secure password hashing, HMAC, tokens, and UUIDs
JWT Issue and verify JSON Web Tokens for API authentication

Database

Topic Description
FoxDB — Query Builder Fluent query builder and ORM for database operations

Files & Storage

Topic Description
File Manager Read, write, stream, and download files
File Upload Handle multipart file uploads safely
Session Manager Session data, flash messages, and counters

Advanced

Topic Description
Console CLI commands and task automation

Core Library

Webrium is powered by webrium/core — a standalone PHP component library that can be used independently in any project.


What's new in v4.0.0

  • Kernel class introduced as the application execution core
  • Controller dispatch decoupled from File and Directory
  • Header::respond() as the canonical HTTP response method
  • Url::input() handles all request body parsing
  • Route::source() supports custom directory paths
  • Class-based middleware support (Middleware@handle or Middleware::class)
  • Middleware failure returns 403 instead of falling through to the next route
  • Both string ('Controller@method') and array ([Controller::class, 'method']) route syntax supported
  • boot() and teardown() controller lifecycle hooks
  • Event::once() fixed
  • declare(strict_types=1) across all source files
  • Mail stub removed

License

Webrium is open-sourced software licensed under the MIT license.

About

Webrium is a lightweight PHP framework for web development

Topics

Resources

License

Stars

Watchers

Forks

Contributors