Fluxor Core is a minimal PHP MVC engine designed to provide simplicity and speed without sacrificing functionality. With features like file-based routing and an elegant Flow syntax, it ensures developers can build applications rapidly and efficiently, all while maintaining transparency and clarity in their code.
Fluxor Core is a lightweight PHP MVC engine designed to facilitate the creation of elegant applications while maintaining high performance and simplicity. With file-based routing and a refined Flow syntax, Fluxor Core enables developers to build robust web applications without the overhead associated with traditional frameworks.
Key Features
- Exceptional Speed: Experience blazing fast performance with boot times under 10ms, ensuring quick response times for your users.
- Zero Dependencies: Built using pure PHP, Fluxor Core does not impose any core dependencies, providing maximum flexibility.
- Readable Code: The framework emphasizes transparency and ease of understanding, allowing developers to read and comprehend all underlying classes and functionality.
- File-based Routing: Inspired by Next.js, this routing method simplifies the organization and management of application routes.
- Elegant Flow Syntax: Define routes succinctly and intuitively, enhancing development speed and accuracy.
- Secure Configuration: Features config locking to safeguard critical settings and ensure application integrity.
- Built-in CORS Support: Manage cross-origin resource sharing efficiently with global or per-route configuration options.
Core Concepts
Application Instance
Initialize the application easily:
$app = new Fluxor\App();
$basePath = $app->getBasePath(); // Auto-detected
$baseUrl = $app->getBaseUrl(); // Auto-detected
Global CORS Configuration
Seamlessly allow cross-origin requests:
$app->cors()->allowOrigin('*')->enable();
$app->run();
File-based Routing Example
Set up routes efficiently:
Flow::GET()->do(function($req) {
$userId = $req->param('id');
return Response::success(['user' => $userId]);
});
Middleware Implementation
Protect routes using middleware:
$router = $app->getRouter();
$router->addMiddleware('auth', function($request) {
if (!$request->isAuthenticated()) {
return Fluxor\Response::redirect('/login');
}
});
Response Management
Handle various responses effectively:
return Response::json(['user' => $user]);
return Response::view('profile', ['user' => $user]);
Flow Syntax Usage
Employ simple yet powerful routing methods:
Flow::GET()->do(fn($req) => 'Hello World');
Flow::POST()->to(UserController::class, 'store');
Flow::use(fn($req) => $req->isAuthenticated() ? null : redirect('/login'));
View System Example
Render views from controllers easily:
return Response::view('home', ['title' => 'Home']);
Global Helpers
Utilize convenient helper functions for better code:
$debug = env('APP_DEBUG', false);
$url = base_url('api/users');
abort(404, 'Not Found');
Documentation
For comprehensive guidance on using Fluxor Core, refer to the full documentation available at Fluxor Documentation. This resource includes topics such as installation, routing, syntax, configurations, and an API reference.
Fluxor Core is the ideal choice for developers seeking a minimalistic yet powerful framework to enhance their PHP applications, allowing for elegant design and swift functionality.
No comments yet.
Sign in to be the first to comment.