celema / core
Celema core web framework
Requires
- php: ^8.5
- ext-fileinfo: *
- celema/console: ^0.3
- celema/container: ^0.5
- celema/router: ^0.4
- laminas/laminas-httphandlerrunner: ^2.4
- psr/http-factory: ^1.0
- psr/http-message: ^1.1 || ^2.0
- psr/http-message-implementation: ^1.0
- psr/http-server-handler: ^1.0
- psr/http-server-middleware: ^1.0
- psr/log: ^3.0
Requires (Dev)
- celema/dev: ^5.0
- guzzlehttp/psr7: ^2
- laminas/laminas-diactoros: ^2 || ^3
- nyholm/psr7: ^1.5
- nyholm/psr7-server: ^1
README
Celema Core is a lightweight and easily extendable PHP 8.5+ web framework.
[!WARNING] This library is under active development, some of its features are still experimental and subject to change. Large parts of the documentation are missing.
It features:
- Http Routing.
- An autowiring container used for automatic dependency injection.
- Middleware.
- Error handling for PSR-15 request pipelines.
- Convenience wrappers for PSR request, response and middleware.
- Logging.
Routing
App exposes the router's common route helpers and runs requests through the router RoutingHandler internally.
use Celema\Core\App;
use Celema\Router\Group;
$app = App::create();
$app->get('/health', [HealthController::class, 'show'], 'health');
$app->map(['GET', 'POST'], '/login', [AuthController::class, 'login'], 'login');
$app->any('/webhook', $webhook, 'webhook');
$app->group('/admin', function (Group $admin) use ($auth): void {
$admin->middleware($auth);
$admin->controller(AdminController::class);
$admin->get('', 'index', 'admin.index');
$admin->post('/login', 'login', 'admin.login');
});
Development servers
Core provides two console command classes for local development:
Celema\Core\Server\Serverruns the application with the PHP CLI's built-in server.Celema\Core\Server\FrankenPhpruns it with thefrankenphpexecutable fromPATH.
Register either class with celema/console using a factory that supplies the application's public directory. Both commands support host, port, request-log filtering, and BrowserSync-backed --watch mode. The FrankenPHP command uses classic mode, not worker mode; its --debug option enables verbose Caddy logs. FrankenPHP embeds its own PHP runtime, extensions, and configuration rather than using the PHP CLI that starts the command.
Development example
The repository's example app exercises routing, autowiring, request and response helpers, middleware, error handling, static assets, and request-log states. Run it on port 1973 with either development server:
./app/run server
./app/run frankenphp
Add --watch to run BrowserSync and reload when the example or Core source changes.
Supported PSRs:
- PSR-3 Logger Interface
- PSR-4 Autoloading
- PSR-7 Http Messages (Request, Response, Stream, and so on.)
- PSR-11 Container Interface
- PSR-12 Extended Coding Style
- PSR-15 Http Middleware
- PSR-17 Http Factories
License
This project is licensed under the MIT license.