foundation library

The application, container, configuration, environment, facades and logging.

A subset of package:daravel/daravel.dart for files that need only this area, or whose own names collide with the full barrel (JwtException, UniqueRule, ModelNotFoundException, CorsMiddleware, ...).

Classes

App
Container access.
AppConfig
Core application settings (config/app.php parity).
Application
The application: owns the container, configuration, router and kernel (BLUEPRINT_V2 §7.1.2, §5.3).
ApplicationBuilder
Fluent builder mirroring Laravel's Application::configure().
BindingKey
Identifies a binding: a Type plus an optional name for contextual bindings (for example two Disk implementations registered as local and s3).
CacheJwtDenylist
Revoked JWT ids in a CacheStore, so a logout holds on every worker isolate (the process store) or every machine (database).
CacheRateLimitStore
Rate limits counted in a CacheStore (CACHE_LIMITER, Laravel's cache.limiter): with the database store, every machine sharing the database shares the limits (scope cluster).
Clock
The framework's source of "now" (BLUEPRINT_V2 §7.11).
Config
Configuration access (Config.get('app.name')).
ConfigIssue
A problem found by ConfigValidator.
ConfigRepository
Holds typed configuration sections and their dot-notation projection.
ConfigSection
A typed configuration section (ADR-007). Each section is registered once and projected into the dot-notation map used by Config.get('app.name').
ConfigValidator
Validates configuration at boot (BLUEPRINT_V2 §5.3 step 3, §9.2).
ConsoleHandler
Human-readable lines; warnings and above go to err.
Container
The IoC container (BLUEPRINT_V2 §7.1.1, ADR-001).
Context
Laravel 11's Context: data that belongs to the current request, job or command, added to every log record and carried into the jobs it dispatches:
ContextRepository
Data of one request, job or command (Laravel 11's Context).
DailyFileHandler
daravel-YYYY-MM-DD.log files rotated daily, keeping days files.
DB
Database access.
DeferredServiceProvider
A provider whose bindings are registered lazily, the first time one of the types in provides is resolved from the container (Laravel's DeferrableProvider). Registration must be synchronous because Container.make is synchronous; boot is not invoked for deferred providers.
DrainSignal
Completes when the application starts shutting down (SIGTERM or ServerEngine.stop): long-lived responses (server-sent events) end cleanly so clients reconnect elsewhere, instead of holding the shutdown until its timeout.
EmbeddedWorkers
Queue worker and scheduler isolates started by Application.serveWith (serve --embed-queue --embed-scheduler), so one process can serve HTTP, process jobs and run the schedule without supervisord or cron.
Env
Typed access to environment variables loaded from .env files, the OS environment and explicit overrides (BLUEPRINT_V2 §7.1.3).
JsonHandler
One JSON object per line (containers, log shippers).
Log
Logging access.
LogContext
Per-scope (request/job/command) context added to every log line.
Logger
Structured logger with channels, scope context and redaction (BLUEPRINT_V2 §7.10.3).
LoggingConfig
LOG_* configuration (config/logging.php).
LogHandler
Destination of log records (console, JSON stdout, daily file, memory…).
LogRecord
One log entry as handed to LogHandlers.
MemoryHandler
Keeps records in memory; returned by Log.spy() for assertions.
PhpObject
A PHP object read by phpUnserialize (O:8:"stdClass":1:{...}): its class name and properties, kept so the value can be written back unchanged by phpSerialize. Daravel code does not create these.
Schema
Schema access.
Scope
Per-request/job/command/test storage created by Container.runScoped.
ServiceProvider
Registers and boots services, mirroring Laravel's two-phase providers.

Enums

ConfigIssueLevel
Severity of a ConfigIssue.
EmbeddedRole
What an embedded isolate runs next to the HTTP server.
Lifetime
Lifetime of a binding registered through a factory.
LogLevel
RFC 5424 levels (ordered by severity).

Constants

daravelVersion → const String
The Daravel release (kept equal to every workspace pubspec.yaml version by test/foundation/version_test.dart).

Functions

currentLaravelCompat() → int
The COMPAT_LARAVEL_VERSION of the active application, or AppConfig.defaultLaravelCompat outside one (a unit test of a validator, a script).
currentLocale() → String
The locale of the current request, job or command: the one set with setCurrentLocale in this scope, else the application's (APP_LOCALE). Translations and validation messages follow it.
env(String key, [String? fallback]) → String?
Reads an environment variable from the active application.
inject<T extends Object>({String? name}) → T
Resolves T from the active container (Laravel's resolve()), with T inferred from where the value goes, so a default stays mockable:
jsonDate(DateTime time) → String
Serializes time the way Laravel serializes dates to JSON (Carbon::toJSON()): UTC ISO-8601 with microseconds, 2026-01-02T03:04:05.000000Z.
looksPhpSerialized(String data) → bool
Whether data starts like a serialize() payload, so a reader can tell it from JSON without parsing.
maybeInject<T extends Object>({String? name}) → T?
inject, or null when nothing is bound for T.
phpJsonFromDart(String json, {bool emptyMapsAsArrays = false, bool escapeSlashes = true}) → String
Rewrites json (the output of dart:convert's encoder) into the bytes PHP's json_encode() writes with default flags: / becomes \/ and every non-ASCII UTF-16 unit \uxxxx (lower-case hex, surrogate pairs as two escapes). Control characters and quotes are already escaped the same way by both.
phpRawUrlEncode(String value) → String
PHP's rawurlencode: every byte of the UTF-8 encoding except A-Z a-z 0-9 - _ . ~ becomes %XX (upper case).
phpSerialize(Object? value) → String
PHP serialize() of value: null, bool, int, double, String, List (an array with keys 0..n-1), Map (an array; a key that is a canonical decimal integer becomes an integer key, as PHP does) and PhpObject. Strings count UTF-8 bytes. Anything else throws ArgumentError.
phpUnserialize(String data) → Object?
PHP unserialize() of data: arrays whose keys are exactly 0..n-1 in order become a List, other arrays a Map<String, Object?> (integer keys as decimal strings), objects a PhpObject. References (r:, R:) and Serializable payloads (C:) throw FormatException, as does any malformed input.
setApplicationLocale(String locale) → void
Sets the application locale (APP_LOCALE, at boot).
setCurrentLocale(String locale) → void
Sets the locale of the current scope (Laravel's App::setLocale), so concurrent requests never see each other's; outside any scope, the application's.

Typedefs

ConfigCheck = Iterable<ConfigIssue> Function(Env env, ConfigRepository config)
A reusable configuration check.
EnvDecrypter = Future<String> Function(String contents, String key)
Decrypts the contents of an encrypted environment file with key (EnvironmentEncrypter.decrypt in the application).
Factory<T extends Object> = T Function(Container container)
Builds an instance of T using the Container.

Exceptions / Errors

BindingResolutionException
Thrown when Container.make cannot find a binding for the requested type.
CircularDependencyException
Thrown when two factories depend on each other, directly or indirectly.
ConfigException
Raised for missing configuration keys/sections or type mismatches.
DaravelException
Base class for every exception raised by the framework itself.
EnvException
Raised for malformed .env files or missing/invalid environment values.
ScopeDisposeException
Raised by Scope.dispose when one or more dispose callbacks failed.
ScopeRequiredException
Thrown when a scoped binding is resolved outside of an active Scope.