Download the PHP package horizom/core without Composer
On this page you can find all versions of the php package horizom/core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package core
horizom/core
The core of the Horizom framework - a PSR-oriented PHP 8 micro-framework built around a DI container, a service provider system, a router, and a PSR-15 middleware pipeline.
Note: This repository contains the Horizom core code. To create a complete application, see the main repository horizom/app.
Table of Contents
- horizom/core
- Table of Contents
- Requirements
- Installation
- Quick Start
- Architecture
- Components
- Application (
App)- Service Binding
- PSR-15 Middlewares
- Configuration
- Running
- Configuration (
Config) - DI Container (
Container) - Service Providers
- Facades
- Creating a Custom Facade
- Middlewares
BodyParsingMiddlewareContentLengthMiddlewareExceptionHandlingMiddleware
- Blade View (
View) - Helpers
- Tests
- License
Requirements
| Dependency | Minimum version |
|---|---|
| PHP | 8.0 |
| ext-mbstring | * |
| ext-openssl | * |
Installation
Quick Start
Architecture
Components
Application (App)
App is the framework's central singleton. It orchestrates the DI container, the middleware dispatcher, and the router.
Service Binding
PSR-15 Middlewares
Configuration
Running
Configuration (Config)
Config extends Illuminate\Support\Collection with default values merged automatically at construction time.
Default values:
| Key | Default value |
|---|---|
app.name |
'Horizom' |
app.env |
'development' |
app.base_url |
'http://localhost:8000' |
app.timezone |
'UTC' |
app.locale |
'en_US' |
app.exception_handler |
false |
app.display_exception |
false |
providers |
[] |
aliases |
[] |
DI Container (Container)
Container extends DI\Container (php-di) by adding service provider management.
Service Providers
Service providers encapsulate feature initialization. Two methods are available: register() for DI binding and boot() for post-registration initialization.
Registration in configuration:
Default providers:
| Provider | Role |
|---|---|
CoreServiceProvider |
Defines the HORIZOM_* constants |
ExceptionServiceProvider |
Configures exception handling (Ignition) |
ViewServiceProvider |
Initializes the Blade template engine |
Facades
Facades provide convenient static access to container services without tight coupling.
Creating a Custom Facade
Middlewares
All middlewares implement Psr\Http\Server\MiddlewareInterface.
BodyParsingMiddleware
Automatically parses the request body according to Content-Type.
| Content-Type | Result |
|---|---|
application/json |
array |
application/x-www-form-urlencoded |
array |
application/xml / text/xml |
SimpleXMLElement |
ContentLengthMiddleware
Automatically adds the Content-Length header if it is missing.
ExceptionHandlingMiddleware
Delegates unhandled exceptions to an ExceptionHandler injected through DI.
Blade View (View)
Adapter around illuminate/view to use the Blade template engine without Laravel.
Through the global helper:
Through the facade:
Helpers
Global functions available throughout the application.
| Function | Description |
|---|---|
app() |
Returns the App instance |
config($key, $def) |
Reads a configuration value |
url($path) |
Generates an absolute URL |
asset($path) |
Generates the URL for a public asset |
view($name, $data) |
Renders a view and writes it to output |
bcrypt($value) |
Hashes a value with Bcrypt |
base_path($path) |
Absolute path from the project root |
storage_path($path) |
Path to storage/ |
public_path($path) |
Path to public/ |
resources_path($path) |
Path to resources/ |
Tests
The suite covers:
| Class | Test cases |
|---|---|
Config |
Default values, merging, read/write/exists |
Container |
Registration, force-register, boot, isLoaded |
ServiceProvider |
provides, when, register, boot, defaultProviders |
VersionException |
Default message, code, \Throwable chaining |
BodyParsingMiddleware |
JSON, form-encoded, unknown type, custom parser |
ContentLengthMiddleware |
Header injection, no overwrite when already present |
ExceptionHandlingMiddleware |
Pass-through, delegation, request context propagation |
License
Horizom Core is open-source software released under the MIT license.
All versions of core with dependencies
ext-mbstring Version *
ext-openssl Version *
http-interop/http-factory-guzzle Version ^1.0
horizom/dispatcher Version ^5.2
horizom/http Version ^5.2
horizom/routing Version ^5.2
illuminate/config Version ^8.0
illuminate/collections Version ^8.0
illuminate/contracts Version ^8.0
illuminate/container Version ^8.0
illuminate/support Version ^8.0
illuminate/view Version ^8.0
middlewares/utils Version ^3.2
nyholm/psr7 Version ^1.5
php-di/invoker Version ^2.1
php-di/php-di Version ^6.0
psr/container Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.0
psr/http-server-handler Version ^1.0
spatie/ignition Version ^1.12
vlucas/phpdotenv Version ^5.6