Helpers API
Complete API reference for helper classes.
EnvHelper
Section titled “EnvHelper”get(string $key, mixed $default = null): mixed
Section titled “get(string $key, mixed $default = null): mixed”Get environment variable.
$value = EnvHelper::get('APP_NAME', 'default');has(string $key): bool
Section titled “has(string $key): bool”Check if variable exists.
if (EnvHelper::has('API_KEY')) { // ...}set(string $key, mixed $value): void
Section titled “set(string $key, mixed $value): void”Set environment variable.
EnvHelper::set('APP_ENV', 'production');MathHelper
Section titled “MathHelper”add(string $a, string $b, int $scale = 2): string
Section titled “add(string $a, string $b, int $scale = 2): string”Add two numbers.
$result = MathHelper::add('0.1', '0.2', 2); // '0.30'subtract(string $a, string $b, int $scale = 2): string
Section titled “subtract(string $a, string $b, int $scale = 2): string”Subtract two numbers.
$result = MathHelper::subtract('1.0', '0.3', 2); // '0.70'multiply(string $a, string $b, int $scale = 2): string
Section titled “multiply(string $a, string $b, int $scale = 2): string”Multiply two numbers.
$result = MathHelper::multiply('2.5', '3.0', 2); // '7.50'divide(string $a, string $b, int $scale = 2): string
Section titled “divide(string $a, string $b, int $scale = 2): string”Divide two numbers.
$result = MathHelper::divide('10.0', '3.0', 2); // '3.33'compare(string $a, string $b): int
Section titled “compare(string $a, string $b): int”Compare two numbers.
$cmp = MathHelper::compare('1.0', '2.0'); // -1ConfigHelper
Section titled “ConfigHelper”get(string $key, mixed $default = null): mixed
Section titled “get(string $key, mixed $default = null): mixed”Get configuration value.
$value = ConfigHelper::get('app.name', 'default');has(string $key): bool
Section titled “has(string $key): bool”Check if config exists.
if (ConfigHelper::has('database.host')) { // ...}set(string $key, mixed $value): void
Section titled “set(string $key, mixed $value): void”Set configuration value.
ConfigHelper::set('app.debug', true);DotPathHelper
Section titled “DotPathHelper”get(array $data, string $path, mixed $default = null): mixed
Section titled “get(array $data, string $path, mixed $default = null): mixed”Get value at path.
$value = DotPathHelper::get($data, 'user.name');set(array &$data, string $path, mixed $value): void
Section titled “set(array &$data, string $path, mixed $value): void”Set value at path.
DotPathHelper::set($data, 'user.name', 'John');has(array $data, string $path): bool
Section titled “has(array $data, string $path): bool”Check if path exists.
if (DotPathHelper::has($data, 'user.email')) { // ...}unset(array &$data, string $path): void
Section titled “unset(array &$data, string $path): void”Remove value at path.
DotPathHelper::unset($data, 'user.password');ObjectHelper
Section titled “ObjectHelper”deepClone(object $object): object
Section titled “deepClone(object $object): object”Deep clone object.
$clone = ObjectHelper::deepClone($object);toArray(object $object): array
Section titled “toArray(object $object): array”Convert object to array.
$array = ObjectHelper::toArray($object);fromArray(array $data, string $class): object
Section titled “fromArray(array $data, string $class): object”Create object from array.
$object = ObjectHelper::fromArray($data, User::class);getProperty(object $object, string $property): mixed
Section titled “getProperty(object $object, string $property): mixed”Get property value.
$value = ObjectHelper::getProperty($object, 'name');setProperty(object $object, string $property, mixed $value): void
Section titled “setProperty(object $object, string $property, mixed $value): void”Set property value.
ObjectHelper::setProperty($object, 'name', 'John');See Also
Section titled “See Also”- EnvHelper Guide - EnvHelper guide
- MathHelper Guide - MathHelper guide
- ConfigHelper Guide - ConfigHelper guide
- DotPathHelper Guide - DotPathHelper guide
- ObjectHelper Guide - ObjectHelper guide