Skip to content

API Reference ​

Number ​

Number::short() ​

Formats an integer into a compact, human-readable string.

php
Number::short(1_893_234); // "1m"

Number::configure() ​

Applies an output configuration. It can be called multiple times until the configuration is locked.

php
Number::configure(new Config(decimals: 1, upperCase: true));

Number::configureOnce() ​

Applies an output configuration once. Later configuration changes throw LogicException.

php
Number::configureOnce(new Config(decimals: 1));

Language ​

Lang::set() ​

Sets the active language. The optional second argument replaces or clears translation overwrites for that language.

php
Lang::set('ru');
Lang::set('en', overwrites: ['k' => 'kilo']);

Lang::current() ​

Returns the active two-letter language code.

php
Lang::current(); // "en"

Lang::setOverwrites() ​

Sets translation overwrites for one or more languages.

php
Lang::setOverwrites([
    'en' => ['k' => 'kilo'],
]);

Lang::resetToDefaults() ​

Resets the active language to English and clears all language overwrites.

php
Lang::resetToDefaults();