Skip to content

Core\Env

Reads the environment the program runs in: its environment variables, whether it runs in production or development, and facts about the system.

Members

5 members.

MemberSignature
getget(string $name): ?tainted string
secretsecret(string $name): ?secret string
allall(): array<tainted string>
modemode(): Core\Env::Mode
contextcontext(): Core\Env::Context

Enums

  • ModeThe mode a program runs in. There are two modes. A mode sets the defaults of five settings, and you can still change each of those settings on its own.
  • ContextThe kind of run the code is in. Core\Env::context() returns one of these seven cases.
  • PlatformThe operating system family the program runs on. Core\Env::OS is one of these six cases.

Constants

  • Core\Env::EOLThe line ending this platform writes: \r\n on Windows and \n everywhere else. Use it to write text in the platform's own format. Core\Str::lines and Core\IO::lines do not use it, and split on all three line endings.
  • Core\Env::OSThe operating system family, as a Core\Env::Platform case. Compare it with a case, such as Core\Env::OS == Core\Env::Platform::Windows.
  • Core\Env::VERSIONThis runtime's version: three numbers separated by dots, the same string nvs info prints. To compare versions, split it with Core\Str::split and compare the numbers.