Skip to content
docs.
WORKSPACE

Your documentation

Explore the project catalog
Localzet ServerАсинхронный PHP-серверTriangleФреймворк и компоненты✓MIX IDИдентификация и интеграцииHack APIПубличные API хакатонаACNПроект и компонентыUserlay / UserNetПроект и компонентыAxiomПроект и компонентыМесседжинг через почтуПроект и компонентыLWT / JWT / JOSEПроект и компонентыФинансовая аналитика KimaiПроект и компонентыМультипарадигмальная БДПроект и компонентыZorin PlatformПроект и компонентыZorin TrustПроект и компонентыFloraScope / VegwatchПроект и компонентыaegis-qДокументация проектаaevumdbДокументация проектаauditДокументация проектаauto-invest-managerАвтотрейдерcaine-companionДокументация проектаcertbot-cloudflareДокументация проектаClusterLocalzet Server / ClustercmdveilДокументация проектаConsolePHP CLICronБиблиотеки Localzet Serverdata-connectorДокументация проектаdevice-controlDevice Controlenn-projectДокументация проектаEventsБиблиотеки Localzet ServerflowsintДокументация проектаforgeДокументация проектаHttpClientБиблиотеки Localzet ServerinterpreterСобственный языкinvariaДокументация проектаkeynotesДокументация проектаknotrouteKnotroutelaravel-personal-analyticsДокументация проектаlocalzet-osДокументация проектаmeridianДокументация проектаMQTTБиблиотеки Localzet Servernano-kernelСобственная ОСNoterДокументация проектаpersonal-analyticsДокументация проектаProxyБиблиотеки Localzet ServerPSRБиблиотеки Localzet ServerPSR-7Библиотеки Localzet Serverrschs-monitorДокументация проектаsemsealДокументация проектаshardsealДокументация проектаSocketIOБиблиотеки Localzet ServerSOCKS5Библиотеки Localzet Serverstandalone-analyticsДокументация проектаstatic-php-cliДокументация проектаStorageБиблиотеки Localzet ServersutureДокументация проектаtempoweaveДокументация проектаttsСинтез речиTunnelБиблиотеки Localzet Serverui-kitUI KitvesperДокументация проектаWebAnalyzerWebAnalyzerzorin-access-brokerДокументация проектаzorin-authority-brokerДокументация проектаzorin-authority-sdk-phpДокументация проектаzorin-authority-sdk-pythonДокументация проектаzorin-authority-sdk-tsДокументация проектаzorin-client-intelДокументация проектаzorin-device-core-aospДокументация проектаzorin-host-agentДокументация проектаzorin-native-labДокументация проектаzorin-nodeДокументация проектаzorin-opsДокументация проектаdonstu-python-sdkДокументация проектаfloortraceFloortraceserver-rsLocalzet Server / Cluster
Catalog
Documentation/Triangle

Engine: configuration, context and container

Engine supplies application primitives; HTTP/WS engines and components add request dispatch and integration. Its manifest requires PHP ^8.1, intl/json and Server ^4. A compatible application can have higher transitive PHP requirements.

use Triangle\Engine\Container;
$container = new Container();
$container->addDefinitions([
'clock' => static fn (Container $container): object => new stdClass(),
]);
$clock = $container->get('clock');

Definitions are callbacks passed the container; get() caches the result. A zero-argument class can be constructed when no definition exists. has() checks registered definitions/instances rather than all autoconstructible classes. make(class, constructorArgs) creates an instance using positional argument values; it is not recursive reflection autowiring. Do not store per-user mutable state in a cached service. The class implements the PSR container interface, but exception behavior must be reviewed before claiming full PSR-11 conformance.

Config::load/loadAll/reloadAll/clear/get/set manage a filename-keyed tree; see configuration for overlay and route-file behavior. Autoload coordinates CLI/Server startup, includes application files and invokes Bootstrap. Bootstrap calls available middleware/database/session/router/events components and configured bootstrap classes. A component may be absent and skipped, so successful startup alone does not prove it is enabled.

Context provides get/set/delete/onDestroy/destroy and uses runtime-specific context storage. Treat it as scoped state and verify cleanup for the selected runtime; it is not a durable store. Engine Request/Response extend Server HTTP types, while the selected engine/scaffold can expose Triangle request/response aliases. Use the aliases expected by the installed application when writing controllers.

responseJson() serializes a direct JSON payload; response() may wrap data, choose a view and alter status via http_always_200. Its default JSON flags include JSON_NUMERIC_CHECK: override options when numeric-looking strings such as identifiers must remain strings. Use view() through the View component rather than an invented facade. Helpers require the appropriate application context.

Source declaration index · Components · Compatibility. Engine source revision 89dac7f51f94.