essentio / core
A minimalist PHP micro-framework for people who prefer simple structure and full control—without the bloat, dogma, or dependency hell.
Requires
- php: ^8.2
Requires (Dev)
- pestphp/pest: ^3.8
- rector/rector: ^2.0
- vimeo/psalm: ^6.12
Suggests
- ext-pdo: Required for database access using PDO (e.g. MySQL, SQLite, PostgreSQL)
This package is auto-updated.
Last update: 2025-08-21 15:16:49 UTC
README
Essentio - Minimalist PHP Framework [WIP]
Essentio isn’t here to impress with design patterns or win internet debates. It’s raw, minimal PHP for developers who want clarity, speed, and control. No abstractions, no ceremony. Just the essentials.
Built specifically for building apps, Essentio focuses on a powerful set of helper functions that streamline common development tasks. So you can go from zero to working application in minutes.
You can learn the entire framework in an afternoon. That’s the point.
🔥 Philosophy
Essentio exists because modern PHP frameworks lost the plot.
Somewhere along the way, we decided every project needs hundreds of dependencies, a build chain, and layers of abstraction just to respond to a request. The result? Bloat, boilerplate, and a constant sense that you're working around your tools instead of with them.
Essentio is built around simpler questions:
- Why can’t I just write code and have it run?
- Why does “Hello World” pull in a hundred packages?
- Do frameworks need to be opinionated, or just useful?
- Why all the scaffolding, code generation, and ceremony?
- What if I could learn the entire framework in a single afternoon?
This isn’t for everyone. It’s for developers who want full control without the hand-holding. Who trust their own judgment more than someone else’s defaults. Who read the source instead of tutorials.
Essentio doesn’t try to teach you how to code. It gives you just enough structure to be useful and nothing that gets in your way.
🧪 Quickstart
Choose one of three approaches to pull in the framework, then bootstrap and run your application.
1. Single file (fastest)
Include a single PHP file containing only the modules you need. This is great for rapid prototypes or simple scripts.
Available builds:
Component | base | base+ | cli | cli+ | http | http+ | api | api+ | web | web+ | full | full+ |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Application Container Environment |
✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Argument | ✓ | ✓ | ✓ | ✓ | ||||||||
Request Response Router Route |
✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||
Jwt | ✓ | ✓ | ✓ | ✓ | ||||||||
Session Template |
✓ | ✓ | ✓ | ✓ | ||||||||
Cast Validate |
✓ | ✓ | ✓ | ✓ | ||||||||
HttpClient Query |
✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Download:
And run curl -L <url> -o framework.php
Bootstrap + Web Entry: create public/index.php in the project root:
<?php require_once __DIR__ . '/../framework.php'; Application::http(__DIR__ '/..'); get('__ping', fn() => text('pong')); Application::run();
2. Download into src/ (recommended)
Copy the framework files into a src/ folder for full ownership without Composer.
Init:
This scaffolds out a simple starting point (You can also manually build this out, you are not bound to this)
mkdir <project> cd <project> curl -s https://raw.githubusercontent.com/Phil-Venter/essentio-core/refs/heads/main/bin/download.php | php php cli serve
Visit: http://localhost:8000/__ping
3. Install via Composer (limited control)
Composer makes installation trivial, but you won’t have direct access to the raw framework files for customization.
composer require essentio/core:dev-main # Just until we cut the first release
Bootstrap + Web Entry: create public/index.php in the project root:
<?php require_once __DIR__ . '/../vendor/autoload.php'; Essentio\Application::http(__DIR__); get('__ping', fn() => text('pong')); Essentio\Application::run();
Note: Composer will follow our release cycle. If you need to modify core behavior or patch bugs yourself, use the “Single file” or “Download into src/” methods instead.
🧱 Features
No ceremony. No surprises. A focused set of helper functions makes building applications straightforward and efficient.
Class | Description |
---|---|
Application |
Initializes HTTP or CLI context |
Container |
Dependency injection container |
Router |
Route registry and dispatcher |
Request |
Normalized HTTP request abstraction |
Response |
Fluent HTTP response builder |
Session |
Native session management + CSRF support |
Template |
Layout/segment PHP-based template engine |
Jwt |
Stateless JWT encoder/decoder |
Environment |
.env file parser with auto-casting |
FrameworkException |
Base exception type for internal framework errors |
ValidationException |
Thrown when validation rules fail |
HttpException |
Structured HTTP error generator |
Cast |
Input transformation (type coercion) |
HttpClient |
Minimal HTTP client using cURL |
Query |
Fluent SQL query builder (PDO-based) |
Validate |
Validation rules (regex, bounds, etc.) |
Function | Description |
---|---|
app(class) |
Get a singleton instance |
make(class, deps) |
Create a new instance |
bind(class, ...) |
Register service (multi-call) |
once(class, ...) |
Register singleton (one-time) |
base_path(path) |
Join path to base directory |
env(key) |
Retrieve .env variable |
middleware(fn) |
Global middleware registration |
group(prefix, fn) |
Grouped routes under a prefix |
get(path, fn) post(path, fn) put(path, fn) patch(path, fn) delete(path, fn) |
Route registration for HTTP verbs |
request(key) input(field) |
Access route/query/form input |
sanitize(rules, onError) |
Cast + validate user input |
session(key) |
Get/set session variable |
flash(key) |
Temporary one-request data |
csrf() / csrf(token) |
Generate or verify CSRF token |
jwt(data) |
Encode/Decode JWT payload |
data_to_xml(array/object) |
Convert a datastructure to XML string |
e(scalar/Stringable) |
Safely escapes a value for use in HTML |
render(template, data) |
Render template to string |
html(str) text(str) json(mixed) xml(array/object) |
Send typed response content |
redirect(uri, status) |
Issue HTTP redirect |
view(template, data) |
Return templated HTML response |
throw_if(cond, except) |
Conditionally throw an error |
curl(method, url, headers, body) |
Send an HTTP request and return Response |
query() |
Instantiate Query object |
You need to explicitly bind the query builder to the container before using it.
once(PDO::class, fn() => new PDO("sqlite:" . base_path("database.sqlite"))); bind(Query::class, fn() => new Query(app(PDO::class)));
🧍 Who It’s For
Essentio is for developers who:
- Want to understand every line
- Don’t need training wheels
- Trust code over convention
- Want fewer files, fewer surprises, and fewer opinions
- Sick of the boilerplate of big framework
Whether you’re building tools, APIs, internal apps, or microservices, Essentio gives you a sharp knife and walks away.
🧪 What It Doesn’t Do
Essentio doesn’t care about:
- ❌ Autowiring
- ❌ Scaffolding
- ❌ ORM
- ❌ Code generation
- ❌ File structure
- ❌ Layered abstraction
If it happens, it’s because you wrote it.
🧮 Code Size
FILE | CODE | BLANK | COMMENT | TOTAL |
---|---|---|---|---|
api-plus.php | 1221 | 336 | 452 | 2009 |
api.php | 615 | 164 | 272 | 1051 |
base-plus.php | 479 | 139 | 187 | 805 |
base.php | 197 | 53 | 93 | 343 |
cli-plus.php | 559 | 159 | 208 | 926 |
cli.php | 277 | 73 | 114 | 464 |
full-plus.php | 1433 | 390 | 540 | 2363 |
full.php | 827 | 218 | 360 | 1405 |
http-plus.php | 1142 | 310 | 423 | 1875 |
http.php | 536 | 138 | 243 | 917 |
web-plus.php | 1274 | 344 | 490 | 2108 |
web.php | 668 | 172 | 310 | 1150 |
src/* | 1699 | 472 | 588 | 2759 |
🪪 License
Essentio is licensed under the 0BSD License. No conditions. No attribution. No nonsense.
Use it. Fork it. Rip it apart. Whatever helps you ship.
🤝 Contributing
Pull requests welcome. Ideas welcome. Opinions optional.
Essentio is yours to love, hate, or ignore. The world won’t always agree, but that’s not your problem.