triangle / engine
Low-level HTTP engine for Triangle Framework
Requires
- php: ^8.1
- ext-intl: *
- ext-json: *
- localzet/server: ^7.1
- monolog/monolog: ^3.0
- psr/container: ^1.0|^2.0
- symfony/cache: ~6.4.0
- symfony/translation: ~6.4.0
Requires (Dev)
- phpunit/phpunit: ^10.5
- rector/rector: *
Suggests
- ext-mongodb: For MongoDB logging
- ext-mysqli: For MySQL support
- ext-redis: For Redis support
Provides
None
Conflicts
- symfony/cache: >=7.0
- symfony/translation: >=7.0
Replaces
None
- dev-main
- v9.0.0
- v8.1.11
- v8.1.10
- v8.1.9
- v8.1.8
- v8.1.7
- v8.1.6
- v8.1.5
- v8.1.4
- v8.1.3
- v8.1.2
- v8.1.1
- v8.1.0
- v8.0.9
- v8.0.8
- v8.0.7
- v8.0.6-alpha
- v8.0.5-alpha
- v8.0.4-alpha
- v8.0.3-alpha
- v8.0.2-alpha
- v8.0.1-alpha
- v8.0.0-alpha
- v7.x-dev
- v7.1.0
- v7.0.9
- v7.0.8
- v7.0.7
- v7.0.6
- v7.0.5
- v7.0.4
- v7.0.3
- v7.0.2
- v7.0.1
- v7.0.0
- v6.3.1
- v6.3.0
- v6.2.0
- v6.1.0
- v6.0.1
- v6.0.0
- v5.6.0
- v5.5.2
- v5.5.1
- v5.5.0
- v5.4.6
- v5.4.5
- v5.4.4
- v5.4.3
- v5.4.2
- v5.4.1
- v5.4.0
- v5.3.6
- v5.3.5
- v5.3.4
- 5.3.3
- v5.3.2
- v5.3.1
- v5.3.0
- v5.2.7
- v5.2.6
- v5.2.5
- v5.2.4
- v5.2.3
- v5.2.2
- v5.2.1
- v5.1.2
- v5.1.1
- v5.1
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0.0
- v4.1.0
- V4.0.1
- v4.0.0
- v3.4.1
- v3.4.0
- v3.3.4
- v3.3.3
- v3.3.2
- v3.3.1
- v3.3.0
- v3.2.4
- v3.2.3
- v3.2.2
- v3.2.0
- v3.1.1
- v3.1.0
- v3.0.0
- v2.6.0
- v2.5.4
- v2.5.2
- v2.5.1
- v2.5.0
- v2.4.9
- v2.4.8
- v2.4.7
- v2.4.5
- v2.4.4
- v2.4.3
- v2.4.2
- v2.4.0
- v2.3.8
- v2.3.7
- v2.3.6
- v2.3.5
- v2.3.4
- v2.3.3
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.2
- v2.2.1
- v2.2.0
- dev-feat/docs-release-notes
- dev-feat/server7-engine
- dev-strict_types
- dev-dev
This package is auto-updated.
Last update: 2026-11-20 13:00:33 UTC
README
Triangle Engine is the HTTP and application runtime layer used by Triangle Framework projects. It provides request and response objects, configuration and execution context, application bootstrap helpers, and adapters around Localzet Server.
This development source requires PHP 8.1 or newer and Localzet Server compatible with ^7.1. It is not a standalone web server: the network listener, event loop, protocol handling, and process lifecycle belong to Localzet Server.
Requirements
- PHP
^8.1,ext-intl, andext-json. localzet/server:^7.1.- Monolog
^3.0and PSR Container^1.0or^2.0. - Symfony Cache and Translation
~6.4.0.
The latest published package is v8.1.11 and requires localzet/server:^4. This development source targets Server 7.1. The two versions are not interchangeable:
| Engine version | Server requirement | Status |
|---|---|---|
v8.1.11 |
^4 |
Published on Packagist |
| Development source | ^7.1 |
Server 7 migration; not yet a compatible stable release |
Do not install the published v8.1.11 into an application that uses Server 7.1. Inspect the selected packages before upgrading:
composer show triangle/engine composer show localzet/server
For the current development source, configure the repository and install its development branch only in a development environment:
composer config repositories.triangle-engine vcs https://github.com/Triangle-org/Engine composer require triangle/engine:dev-main@dev
When the compatible major release is published, use its stable version constraint for production.
Main components
Triangle\Engine\Configloads and reads application configuration.Triangle\Engine\Contextstores values for the active Fiber or coroutine; callContext::destroy()when a request or task finishes.Triangle\Engine\RequestandTriangle\Engine\Responseadapt Localzet Server HTTP messages for Triangle applications.support\Appassembles configured listeners and processes for a Triangle application.Triangle\Exceptioncontains the framework exception types and rendering contracts.
Use the application bootstrap already provided by your Triangle project. Engine does not create a listener or choose a deployment topology on its own.
Compatibility with Server 7.1
Server 7 defines global response(), json(), and redirect() helpers. Their names overlap with older Engine helpers but their return values and behavior differ. Engine now exposes explicit names for its own behavior:
| Helper | Engine behavior | With Server 7.1 loaded |
|---|---|---|
triangle_response() |
Engine response envelope and content negotiation | Use this to retain Engine behavior |
triangle_json() |
Encodes a PHP value as a JSON string | Use this when a string is needed |
triangle_redirect() |
Returns Triangle\Engine\Response and strips CR/LF from the location |
Use this when Engine's response type is required |
responseJson() / responseBlob() |
Build an Engine response | Keep using these helpers |
The unprefixed names resolve to Server's helpers when Server is loaded first. This source guards its optional legacy declarations so Composer autoload does not redeclare those functions. Update direct application calls to response(), json(), or redirect() when they relied on Engine-specific semantics.
Migrating Engine 8 helper calls
| Engine 8 call | Engine 9 replacement | Return contract |
|---|---|---|
json($data) |
triangle_json($data) |
JSON string |
response($data, $status) |
triangle_response($data, $status) |
Engine response envelope and content negotiation |
redirect($url, $status) |
triangle_redirect($url, $status) |
Triangle\Engine\Response |
If the application needs a JSON HTTP response without the Engine envelope, use responseJson($data, $status). Calls without the triangle_ prefix now follow the Server 7 contract, so update the call site according to whether it needs a string, an Engine response, or a Server response.
The current Context implementation keys storage by the active PHP Fiber regardless of the selected event-loop class. This matters when asynchronous handlers interleave on Server 7's standard event loops.
Tests
Install the development dependencies and run the declared PHPUnit suite:
composer install
composer test
The suite covers configuration, Fiber context isolation, Server 7 helper interoperability, and a real loopback HTTP request through Server 7 using the Engine request and response classes. It does not replace application-level tests for routing, middleware, storage, or deployment behavior.
Documentation and support
Copyright © 2016-2026 Localzet Group. All rights reserved.