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.1
- 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-12-04 21:42:27 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.
The published v9.0.1 release supports PHP 8.1 or newer and Localzet Server ^7.1. Engine is not a standalone web server: Localzet Server provides the listener, event loop, protocol handling, and process lifecycle.
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.
| Engine version | Server requirement | Status |
|---|---|---|
v9.0.1 |
^7.1 |
Stable release on Packagist |
v8.1.11 |
^4 |
Previous major; incompatible with Server 7 |
Install the stable release with Composer:
composer require triangle/engine:^9.0 composer show triangle/engine localzet/server
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. Environment variables should be read with triangle_env($key, $default) when typed boolean and numeric values are needed. The generic global env() may be supplied by another Composer dependency, such as Illuminate, and can return raw strings instead of Engine's parsed values.
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.