Download the PHP package php-concept/core without Composer
On this page you can find all versions of the php package php-concept/core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package core
Concept Core
Concept Core is an aesthetic, strict-typed PHP engine built on PSR standards.
A strict-typed PHP application engine for builders who want ergonomics without the monolith.
Concept Core is the foundation of the Concept stack: a lean, PSR-native runtime that wires routing, DI, validation, database access, views, and CLI into a coherent whole — then gets out of your way. Applications are assembled from components: self-contained modules that ship their own routes, migrations, seeders, views, assets, and service providers.
Built for PHP 8.4+, every public API uses declare(strict_types=1) and is designed to be extended, not overridden.
No magic — no hidden conventions you cannot grep for.
Why Concept Core?
| You get | Without |
|---|---|
| Named routes, middleware, FormRequests, DTO casting | Re-implementing half of a framework on every project |
| Illuminate Database (Eloquent, migrations, pagination) | Dragging in all of Laravel |
| Twig or Plates, your choice | Lock-in to one templating story |
| Component registry — drop in Auth, ACL, CMS as packages | Copy-pasting modules between repos |
| PSR-7 HTTP, PSR-11 container, PSR-15 middleware | Fighting legacy globals |
| Whoops in dev, safe fallbacks in prod | White screens and silent failures |
| Built-in telemetry hooks | Guessing what booted and when |
Concept Core is not a CMS and not a full-stack framework. It is an engine: opinionated where it matters (request lifecycle, validation, errors), flexible everywhere else (authorization, business logic, UI).
Architecture at a glance
Request flow
Appboots service providers;ComponentsServiceProviderregisters component routes, migrations, seeders, views, and commands.Routermatches a route; middleware runs (CSRF, validation handler, view data, …).RouteStrategyinvokes the handler: route interceptors first, then autowiring (FormRequest validation, route-param casting,ServerRequestInterface).- Controller returns a PSR-7 response;
SapiEmittersends it.
Tech stack
| Layer | Library |
|---|---|
| HTTP messages | laminas/laminas-diactoros |
| HTTP runner | laminas/laminas-httphandlerrunner |
| Routing | league/route |
| DI | league/container |
| Database | illuminate/database |
| Validation | rakit/validation (via magewirephp/validation) |
| DTO mapping | cuyz/valinor |
| Views | twig/twig or league/plates |
| Console | symfony/console |
| Sessions & flash | symfony/http-foundation |
| Config | hassankhan/config |
| Logging | monolog/monolog |
| Errors (dev) | filp/whoops |
| Env | vlucas/phpdotenv |
Quick start
Install
Requires PHP 8.4+ and extensions: pdo, json, mbstring, dom, xml.
Minimal bootstrap
Front controller (public/index.php)
Console entry (bin/console.php)
Components — the killer feature
A component is a vertical slice of your application: routes, providers, migrations, seeders, views, console commands, and publishable assets — bundled behind one class.
Register the component class in config (resolved from the container via ReflectionContainer):
ComponentsServiceProvider automatically:
- loads each component's
routes()file into the router; - registers component service providers;
- merges migration paths and seeder classes into registries;
- attaches Twig extensions and view namespaces;
- registers console commands;
- maps URL prefixes to view contexts (e.g.
/admin→dashboardlayout).
ComponentInterface methods:
| Method | Returns |
|---|---|
providers() |
Extra DI service provider classes |
migrations() |
Migration directory paths |
seeders() |
Seeder class names |
commands() |
Symfony console command classes |
viewPaths() |
Twig/Plates namespaces (@auth-admin/...) |
viewContexts() |
URI prefix → layout namespace |
viewExtensions() |
Twig extension classes |
assets() |
Source → public publish map |
Ship a feature once. Reuse it in every project.
HTTP layer
Routing
Routes live in plain PHP files. League Route gives you groups, middleware, and named routes:
Generate URLs anywhere:
List routes from CLI:
RouteStrategy — autowiring that actually helps
The controller instance is resolved from the container (constructor injection via ReflectionContainer). Action method parameters are filled by RouteStrategy:
| Parameter type | Resolved from |
|---|---|
FormRequest subclass |
Container instance, validated, injected (throws ValidationException on failure) |
ServerRequestInterface |
Current PSR-7 request (route vars already attached) |
Route vars (int $id) |
URL segment, cast via Valinor (CasterInterface) |
| Parameters with defaults | Default value |
| Anything else | null |
No manual $request->getAttribute('id') boilerplate for route parameters.
Route interceptors
Pre-controller hooks configured in config/routes.php:
Throw your own exceptions; core stays agnostic. Pair with middleware like HandleValidationExceptionMiddleware for redirects and JSON errors.
Built-in middleware
| Middleware | Role |
|---|---|
VerifyCsrfTokenMiddleware |
CSRF verification on mutating requests |
HandleValidationExceptionMiddleware |
Redirect back with errors / JSON 422 |
ShareViewDataMiddleware |
Flash, old input, CSRF token → view context |
StorePreviousUrlMiddleware |
Tracks previous/current URL in session; sets safe_back_url for ResponseFactory::back() |
ParseJsonBodyMiddleware |
JSON request bodies |
ForceJsonResponseMiddleware |
API-style error responses |
Response factory
Validation & DTOs
FormRequest
In the controller:
Features:
- Rakit rules with custom rule registration via config;
- localized messages from
{validator_translations}/{locale}.php(path mapped inbootstrap/paths.php, typicallyresources/lang/validator); - field aliases and per-request message overrides;
- automatic CSRF field exclusion;
- optional validation payload logging (masked).
Valinor casting
Route parameters and DTOs are mapped with Valinor — cached mappers, scalar coercion, superfluous key tolerance. Route-param cast failures throw CastingException; DTO mapping via FormRequest::toDto() wraps failures as ValidationCastException.
Database
Illuminate Capsule + Eloquent without the Laravel kernel:
- fluent query builder and Eloquent models;
- migrations via
Illuminate\Database\Migrations\Migrator; - seeders aggregated from app + components;
- pagination wired to the current request URI;
- optional SQL query logging to Monolog.
CLI
Migrations and seeders from all registered components are merged automatically.
Views
Switch engines via service provider — register one of:
TwigServiceProvider(.twig, compiled cache in production)PlatesServiceProvider(.phptemplates)
Namespaces & contexts
App-level config (config/view.php) or component viewPaths() / viewContexts() / viewExtensions():
Render:
ShareViewDataMiddleware injects errors, old, flashes, and csrf_token into every view.
Configuration
PHP config files merged via Noodlehaus Config. Canonical keys live in Concept\Core\Foundation\ConfigKey:
app.name,app.debug,app.version,app.locale,app.fallback_locale,app.timezonedb.*,session.*,log.*(log.db_queries,log.validation_data)routes.list,routes.interceptorscomponents,commands,migrations.paths,migrations.table,seeders.listview.paths,view.contexts,view.extensions,view.cache_dir,view.default_extensionvalidator.rules,masking.*,telemetry.enabled
.env support through vlucas/phpdotenv in the application skeleton.
Security
- CSRF — token generation, session storage, middleware verification, shared as
csrf_tokenview global. - Session — secure cookie options (lifetime,
SameSite,HttpOnly, strict mode). - Data masker — redact passwords, tokens, and custom patterns before they hit logs.
- Validation whitelist —
validated()returns only keys defined inrules().
Authorization (ACL, policies, gates) is intentionally application-level via route interceptors and middleware — core provides the hook, you bring the rules.
Error handling
Errors are handled from the first line of bootstrap:
| Environment | Behaviour |
|---|---|
APP_DEBUG=true |
Whoops Pretty Page (web) |
| CLI | Plain text stack traces |
| Production web | Branded fallback from errors_fallback_views path (bootstrap/paths.php; typically resources/views/errors/fallback) |
| JSON requests | Whoops JsonResponseHandler when RequestFormat::expectsJson() |
All paths log through PhpErrorLogHandler → Monolog. Before providers boot, early failures use resources/views/errors/fallback/500.php. Production handler never leaks stack traces to users.
Telemetry
When telemetry.enabled is true, the framework records bootstrap milestones:
- service provider awakening;
- component registration;
- per-route controller invocation timing.
Useful for debug bars and performance profiling. Access via TelemetryCollector in the container.
Logging
Monolog with rotating file handler (storage/logs). Configurable level, retention, and channel name. Database queries and validation payloads can be logged with automatic masking.
Locale
LocaleServiceProvider resolves the active locale from config or a custom LocaleResolverInterface (app.locale_resolver). Validation messages load from {validator_translations}/{locale}.php with app.fallback_locale fallback.
Service providers (built-in)
Providers live under Concept\Core\Providers\{Group}\*.
| Provider | Registers |
|---|---|
Bootstrap\ConfigServiceProvider |
Config, PathManager, .env |
Http\HttpServiceProvider |
Router, PSR-7 request, URL generator, responses |
Http\SessionServiceProvider |
Symfony session & flash bag |
Support\ValidationServiceProvider |
Rakit validator, translations |
Support\CastingServiceProvider |
Valinor CasterInterface |
Database\DatabaseServiceProvider |
Capsule, migrator, seeder manager |
View\TwigServiceProvider / View\PlatesServiceProvider |
View engine |
View\ViewRegistryServiceProvider |
Paths, extensions, contexts |
Component\ComponentsServiceProvider |
Component boot (routes, migrations, …) |
Console\ConsoleServiceProvider |
Symfony Console application |
Logging\LogServiceProvider |
Monolog |
Bootstrap\ErrorHandlerServiceProvider |
Whoops handlers per environment |
Telemetry\TelemetryServiceProvider |
Telemetry collector |
Support\DataMaskerServiceProvider |
Log redaction rules |
Support\LocaleServiceProvider |
Locale resolution |
Logging\DebugLoggerServiceProvider |
In-memory debug log (dev tools) |
Register only what you need in bootstrap/providers/app.php.
Console commands (core)
| Command | Description |
|---|---|
route:list |
All registered routes, middleware, handlers |
db:migrate |
Run pending migrations |
db:rollback |
Roll back last batch |
migration:list |
Recent migrations from the database table |
db:seed |
Run seeders (all or -c ClassName) |
seeders:list |
Registered seeder classes |
component:list |
Installed components |
component:publish-assets |
Copy component assets to public/ |
view:clear |
Clear compiled Twig cache |
Components can register their own commands the same way.
Development
The core ships with 70+ test classes covering routing, validation, providers, middleware, Whoops integration, and component boot sequences.
Design principles
- Strict types everywhere — fewer surprises at runtime.
- PSR first — interoperable HTTP, container, middleware.
- Composition over inheritance — components and providers, not base controller magic.
- Explicit configuration — no hidden conventions you cannot grep for.
- Fail loud in dev, safe in prod — Whoops vs fallback views.
- Batteries included, swappable — Twig or Plates.
Project layout (application skeleton)
Read the Documenation
License
MIT © Concept Framework contributors.
Concept Core — small kernel, sharp edges, infinite composition.
Build the app. Ship the component. Repeat.
All versions of core with dependencies
league/route Version ^6.2
league/container Version ^5.1
laminas/laminas-diactoros Version ^3.8
laminas/laminas-httphandlerrunner Version ^2.13
filp/whoops Version ^2.18
monolog/monolog Version ^3.10
vlucas/phpdotenv Version ^5.6
hassankhan/config Version ^3.2
symfony/http-foundation Version ^8.0
twig/twig Version ^3.0
illuminate/database Version ^13.1
illuminate/events Version ^13.1
illuminate/pagination Version ^13.1
symfony/console Version ^8.0
illuminate/filesystem Version ^13.1
cuyz/valinor Version ^2.4
magewirephp/validation Version ^1.0
symfony/filesystem Version ^8.0
league/plates Version ^3.6