egl / utils
General-purpose PHP utility helpers shared across EGL projects
Requires
- php: >=8.1
- ext-fileinfo: *
- ext-pdo: *
- psr/container: ^2.0
- psr/log: ^3.0
Requires (Dev)
- deptrac/deptrac: ^4.4
- ergebnis/composer-normalize: ^2.44
- friendsofphp/php-cs-fixer: ^3.75
- masterminds/html5: ^2.7.5
- phpbench/phpbench: ^1.2
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^10.5
- symfony/html-sanitizer: ^6.4
Suggests
- ext-iconv: Required by Str::transcode() (spec r3 FR-31); also improves Str::slug() transliteration when ext-intl is absent. transcode() raises a clear UtilsException if called without it, rather than degrading silently.
- symfony/html-sanitizer: Required by Sanitizer::richText() to sanitize user-authored HTML (spec FR-09b). Not needed unless you render untrusted markup; richText() raises a clear UtilsException if it is called without this installed, rather than returning the input unsanitized.
This package is auto-updated.
Last update: 2026-08-10 12:53:30 UTC
README
General-purpose PHP utility helpers shared across EGL projects
A library written in PHP 8.1+, built and governed to an enterprise quality bar: full CI matrix, static analysis, sanitizers, documented design decisions, and SemVer releases.
What it is
Provide EGL PHP projects (framework-based and native/legacy) with a modern utilities library — Composer package egl/utils, PSR-4 namespace D4np\Utils, PHP 8.1+ — offering typed readonly DTOs, explicit-mechanism security helpers, safe PDO access, hardened session/CSRF handling, and a minimal PSR-11 DI container, replacing ad-hoc per-project solutions (associative-array DTOs, blocklist sanitizers, string-built SQL, silent PDO error modes).
The frozen specification is in
docs/specs/01_spec_utils.md.
Install
composer require egl/utils:^1.0
Registered on Packagist; ^1.0 resolves v1.0.0.
A full consumer on-ramp (runnable examples, the naming map, the rest of the surface) is tracked
as issue #118 — this line only
states that the package installs.
Build, test, run
composer install --optimize-autoloader vendor/bin/phpunit
- Toolchain: Composer (PSR-4 autoload), PHPUnit (Pest optional), PHP-CS-Fixer (PSR-12), PHPStan (max level).
- Supported platforms: Linux (PHP 8.1, 8.2, 8.3).
- Consumers import the public surface via:
use D4np\Utils\Dto\DataTransferObject;.
See docs/development/local-build.md for the full local
setup.
How this project is run
| Document | Purpose |
|---|---|
AGENTS.md |
How AI agents (and humans) work in this repo — the contract. |
ROADMAP.md |
The numbered plan and what is done. |
ISSUES.md |
The GitHub issues, newest first, each with its advisory model/effort route. |
docs/adr/ |
Why it is built the way it is (Architecture Decision Records). |
docs/patterns/ |
Design patterns adopted, rejected, or considered. |
docs/workflow/ |
Git, documentation, release, and maintenance conventions. |
CHANGELOG.md |
User-visible changes per release. |
SECURITY.md |
How to report a vulnerability. |
Milestones
| # | Title | Status |
|---|---|---|
| 1 | Project bootstrap & CI | ✅ done |
| 2 | Support layer | ✅ done |
| 3 | DTO & data mapping | ✅ done |
| 4 | Database | ✅ done |
| 5 | Security | ✅ done |
| 6 | HTTP, container, errors | ✅ done |
| 7 | Release engineering & bridge | ✅ done |
| 8 | PSR-7 bridge (packages/utils-psr7-bridge) |
✅ done |
| 9 | Support & values | ✅ done |
| 10 | Persistence | ✅ done |
| 11 | Http application layer | ✅ done |
| 12 | Security & channels | ✅ done |
| 13 | Documentation & release hygiene (post-1.0) | ⏳ planned |
License
MIT © 2026 Daniel Polo. See LICENSE.