!IMPORTANT: this is an experimental version not to be used for production development
This http-based framework implements the Dispatcher pattern (more info from Oracle Java) and can be configured as a front-controller or delegate the request to an application. Suitable for REST API services or monolithic server-side rendering.
- Dispatcher Pattern: Centralizes HTTP request handling. See
Core/Http/Dispatcher.phpand example usage in01-example-dispatcher-as-front-controller/and02-example-dispatcher-as-proxy-using-application/. - Front Controller vs Proxy: Two main modes. Front controller directly handles requests; proxy delegates to an application. Example directories illustrate both patterns.
- Filters & Interceptors: Custom HTTP filters (
Core/Http/Filter.php) and interceptors (Core/Http/Interceptor.php) can be registered for request/response manipulation. - Negotiation: Request content validation is handled via negotiation classes (
Core/Http/Negotiation.php). - Localization: Uses POEDIT and
.po/.mofiles underlocale/. Requires PHP extensions:gettext,intl,mbstring. - Dependency Injection & Service Locator: DI is used for configuration. See
Core/Utils/ObjectStorage.phpfor service locator, andCore/Boot/Registry.phpfor singleton usage.
- No build step required; PHP >= 8.2 is mandatory.
- Enable required PHP extensions:
filter,gettext,iconv,intl,json,mbstring,reflection,spl. - Debugging: Debugging is enabled for local development only. Sensitive info should be hidden in HTTP requests/responses.
- Security: Set recommended HTTP headers using
.htaccess(Apache),default.config(Nginx), or viaCore/Http/Response::setHeaderin controllers.
- Singletons: Only
Core/Boot/Registry.phpuses singleton; avoid elsewhere. - Localization: Add new languages by creating
.po/.mofiles inlocale/and updating configuration. - Controllers & Views: Organize under
Controllers/andViews/in example directories. Follow naming conventions as shown. - Configuration: Use DI and configuration classes under
Config/andBoot/.
- External dependencies: No composer or package manager; all dependencies are PHP extensions.
- Cross-component communication: Use DI and service locator for sharing state and services.
- Dispatcher:
Core/Http/Dispatcher.php - Service Locator:
Core/Utils/ObjectStorage.php - Singleton:
Core/Boot/Registry.php - Example usage:
01-example-dispatcher-as-front-controller/,02-example-dispatcher-as-proxy-using-application/ - Localization:
locale/
