Every framework service is reachable through a relay in the Laika\Engine\Services namespace. Each relay forwards static calls to the instance bound under its key by Laika\Engine\Relay\CoreProviders.
use Laika\Engine\Services\{Request, Response, Url, Vault};
Request::input('email');
Response::setStatus(201);
Url::base();
Vault::encrypt('secret');
php laika relay:list prints the live bindings.
Relay Laika\Engine\Services\… |
Key | Class Laika\Engine\… |
Lifetime | Docs |
|---|---|---|---|---|
Activity |
activity |
Log\Activity |
singleton | Errors & Logging |
AppKey |
app.key |
App\Key |
singleton | Encryption & Tokens |
Asset |
template.asset |
Template\Asset |
singleton | Assets |
Cache |
cache |
\Laika\Engine\Cache\Cache (the Cache module) |
singleton | Caching |
Config |
config |
Helper\Config |
singleton | Configuration |
Context |
template.context |
Template\Context |
singleton | Assets |
Cookie |
cookie |
Helper\Cookie |
singleton | Responses |
CORS |
cors |
Http\CORS |
singleton | CSRF & CORS |
CSRF |
csrf |
Http\CSRF |
singleton | CSRF & CORS |
Date |
date |
Helper\Date |
singleton | Utilities |
Directory |
directory |
Helper\Directory |
singleton | Files & Storage |
File |
file |
Helper\File |
singleton | Files & Storage |
Hook |
hook |
Helper\Hook |
singleton | Hooks |
Icon |
icon |
Generator\Icon |
singleton | Assets |
Image |
image |
Helper\Image |
new per use | Files & Storage |
Infra |
infra |
App\Infra |
singleton | Resources |
Init |
init |
Helper\Init |
singleton | Sessions |
IP |
ip |
IP\IP |
singleton | Utilities |
Local |
local |
Helper\Local |
singleton | Configuration |
Math |
math |
Helper\Math |
singleton | Utilities |
Meta |
template.meta |
Template\Meta |
singleton | Assets |
MimeType |
mime |
Helper\MimeType |
singleton | Files & Storage |
Nav |
nav |
Nav\Builder |
singleton | Assets |
Option |
option |
Model\OptionModel |
singleton | Errors & Logging |
Page |
page |
Helper\Page |
singleton | Requests |
PhpMetadataParser |
php.metadata.parser |
Helper\PhpMetadataParser |
singleton | Utilities |
Redirect |
redirect |
Http\Redirect |
singleton | Responses |
Regex |
regex |
Regex\Regex |
singleton | Encryption & Tokens |
Request |
request |
Http\Request |
singleton | Requests |
Resource |
resource |
App\Resource |
singleton | Resources |
Response |
response |
Http\Response |
singleton | Responses |
Token |
token |
Generator\Token |
singleton | Encryption & Tokens |
Uid |
uid |
Generator\Uid |
singleton | Encryption & Tokens |
Unique |
unique |
Generator\Unique |
singleton | Encryption & Tokens |
Upload |
upload |
Helper\Upload |
new per use | Files & Storage |
Url |
url |
Helper\Url |
singleton | Requests |
Vault |
vault |
Helper\Vault |
singleton | Encryption & Tokens |
Visitor |
visitor |
Helper\Client |
singleton | Requests |
Two relays don’t share their class’s name: Visitor fronts Client, and AppKey fronts App\Key.
Image and Upload are bound per use because they hold state for one file; every other relay shares one instance for the whole process. That also means singletons keep request state (Request parses input once, Visitor caches the IP) — reset them between jobs in a long-running worker with X::clearResolvedInstance().
| Relay | Key | Class | Notes |
|---|---|---|---|
Laika\Engine\Shield\Service\Shield |
shield |
Laika\Engine\Shield\Shield |
The firewall — see Security (Shield) |
Laika\Engine\Shield\Service\ShieldConfig |
shield.config |
Laika\Engine\Shield\ShieldConfig |
The shared configuration (ShieldConfig::instance()), the same object the static class uses. laika-shield 2.0.3 and earlier couldn’t resolve it — call the static class there. |
Laika\Engine\Session\Session is not a relay — it’s a plain static class, as are SessionConfig and SessionManager. The same goes for Laika\Engine\Route\Url (the router) and Laika\Engine\Model\Connection.
These are used directly, by class name:
| Class | Docs |
|---|---|
Laika\Engine\App\Template |
Templates |
Laika\Engine\Http\Validator |
Requests |
Laika\Engine\Http\ProxyTrust |
Configuration |
Laika\Engine\Helper\Zip, Laika\Engine\Storage\* |
Files & Storage |
Laika\Engine\Helper\Cron, Laika\Engine\System\Command\Runner |
Utilities |
Laika\Engine\Worker\Queue |
Queue |
Laika\Engine\Exceptions\* |
Errors & Logging |
A relay only forwards to a shared instance, so you can construct any class yourself when you want your own copy:
use Laika\Engine\Http\Request;
use Laika\Engine\Sanitizer\NullSanitizer;
$raw = new Request(new NullSanitizer()); // a request that doesn't HTML-encode input
Some classes keep all their state in static properties — CORS, Hook, Config, MimeType, Resource, Asset, Meta, Context, Icon, Uid — so calling them through the relay or on the class does the same thing.