triangle / http
HTTP layer for Triangle Framework based on localzet Server
Requires
- php: ^8.1
- ext-curl: *
- triangle/engine: ^9.0
- triangle/middleware: ^2
- triangle/router: ^2
Requires (Dev)
Suggests
- monolog/monolog: For logging
- predis/predis: For Redis-based session/cache
- swoole/swoole: For async support via Swoole
- swow/swow: For async support via Swow
- vlucas/phpdotenv: For environment variables
Provides
None
Conflicts
Replaces
None
This package is auto-updated.
Last update: 2026-11-20 06:43:18 UTC
README
Triangle Engine HTTP
HTTP adapter for Triangle applications. It connects request handling to Localzet Server 7, Triangle Router, and Middleware; the application bootstrap remains responsible for configuration, routes, and listener startup.
Compatibility
Release 3.x targets PHP 8.1+, Localzet Server 7.1+, Triangle Engine 9, Router 2, Middleware 2, and the PHP cURL extension. Release 2.x remains on the earlier Engine compatibility line. Do not mix the two dependency sets in one lock file.
Install
composer require triangle/engine-http:^3.0
Follow the installation guide for the complete bootstrap and version checks.
Request and response flow
Register routes before collecting the Router dispatcher:
use localzet\Server\Protocols\Http\Response; use Triangle\Router; Router::any('/health', static fn () => new Response( 200, ['Content-Type' => 'application/json'], '{"status":"ok"}', )); Router::collect([]);
Engine HTTP sends requests through route middleware and controller resolution. A Localzet Server HTTP response keeps its status, headers, and body. Other return values become a 200 response with a string body.
Security and limits
- Authentication and authorization belong to the application or its middleware.
- CORS is not enabled by default. Configure
app.http_headerswith explicit origins and headers when cross-origin access is required. - PHP files under a public path are disabled by default; enable them only when the application has a clear need and a reviewable execution boundary.
- Listener, HTTP framing, worker lifecycle, and backpressure are provided by Localzet Server.
See the request guide, configuration, and security guide for production setup.
Checks
composer validate --strict --no-check-publish --no-interaction
composer run test --no-interaction
composer audit --abandoned=report
The test command covers response compatibility and a loopback HTTP request against Server 7.
License
AGPL-3.0-or-later. See LICENSE.