Loading repository data…
Loading repository data…
lizzyman04 / repository
A lightweight PHP MVC engine with file-based routing and elegant Flow syntax.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
The lightweight PHP MVC core that powers Fluxor framework - File-based routing, elegant Flow syntax, and zero bloat.
Fluxor Core is the engine behind the Fluxor PHP framework - a minimal, elegant, and powerful MVC core designed for developers who want simplicity without sacrificing functionality.
Unlike monolithic frameworks, Fluxor Core gives you:
lizzyman04/file-router package; nothing elsecomposer require lizzyman04/fluxor
<?php
require 'vendor/autoload.php';
$app = new Fluxor\Core\App();
$app->run();
Import core classes from their namespaces (PSR-4 autoloaded):
use Fluxor\Core\App;
use Fluxor\Core\Http\Request;
use Fluxor\Core\Http\Response;
use Fluxor\Core\Routing\Flow;
use Fluxor\Core\View;
Breaking change in 2.0: the short-name aliases
Fluxor\Flow,Fluxor\App,Fluxor\Response, etc. were removed. Use the fully-qualified namespaces above.
$app = new Fluxor\Core\App();
$basePath = $app->getBasePath(); // Auto-detected!
$baseUrl = $app->getBaseUrl(); // Auto-detected!
$app = new Fluxor\Core\App();
$app->cors()->allowOrigin('*')->enable();
$app->run();
The directory structure is the route table. URL matching (dynamic [id],
catch-all [...slug], route groups, the compiled-route cache) is handled by
the standalone lizzyman04/file-router
engine; Fluxor adds the Flow syntax and dispatch on top. The route-file
syntax below is unchanged.
// app/router/users/[id].php
use Fluxor\Core\Routing\Flow;
use Fluxor\Core\Http\Response;
Flow::GET()->do(function($req) {
$userId = $req->param('id');
return Response::success(['user' => $userId]);
});
$router = $app->getRouter();
$router->addMiddleware('auth', function($request) {
if (!$request->isAuthenticated()) {
return Fluxor\Core\Http\Response::redirect('/login');
}
});
use Fluxor\Core\Http\Response;
$id = $request->param('id');
$email = $request->input('email');
$token = $request->bearerToken();
return Response::json(['user' => $user]);
return Response::view('profile', ['user' => $user]);
use Fluxor\Core\Routing\Flow;
// Simple route
Flow::GET()->do(fn($req) => 'Hello World');
// Controller binding
Flow::POST()->to(UserController::class, 'store');
// Middleware
Flow::use(fn($req) => $req->isAuthenticated() ? null : redirect('/login'));
// In controller
return Response::view('home', ['title' => 'Home']);
// In view (home.php)
View::extend('layouts/main');
View::section('content');
<h1><?= View::e($title) ?></h1>
View::endSection();
// Environment variables
$debug = env('APP_DEBUG', false);
$dbName = env('DB_NAME', 'database');
// Path helpers
$root = base_path();
$url = base_url('api/users');
$asset = asset('css/app.css');
// HTTP helpers
abort(404, 'Not Found');
return redirect('/dashboard');
// Debug helpers
dump($user);
dd($data); // Dump and die
Full documentation available at: 👉 https://fluxor.tudocomlizzyman.com
The documentation includes:
MIT License - see LICENSE file for details.
Fluxor - Build elegant PHP applications with joy! 🎉