Helpers are functions that help the developer manipulate classes, without having to instantiate them.
Here you will find the helpers that exist in Solital Framework. Some specific helpers are not listed on this page, but you can find them on the next pages of the documentation.
Some helpers can be replaced by methods, as long as you use them inside a Controller.
Debug functions are present in the Modern PHP Exception component.
get_debug_backtrace()
echo var_dump_buffer()
var_dump_debug()
dump_die()
closure_dump()
uniqid_real(int|float $lenght = 13)
ArrayCollection
class without having to instantiate it.collection(mixed $value = null)
Str
class without having to instantiate it.str(string $string)
SimpleCache
instance.cache(?string $drive)
encodeJSON($value)
true
to convert JSON to an array.decodeJSON($value, bool $toArray = false)
Message
class without having to instantiate itmessage(string $key, string $msg = "")
Hash
class without having to instantiate itencrypt(string $value, string $time = '+1 hour')
Hash
class without having to instantiate itdecrypt(string $key)
To get a value from an existing session, leave the $value
parameter empty. To create a new session, inform the session key in the first parameter, and the session value in the second parameter. See more here.
/**
* $key: index that will identify the session
* $value: session value
* $defaultValue: array of values (see Session class documentation)
* $delete: if the value is `true`, the session will be deleted.
* $take: returns the requested value and removes it from the session.
*/
session(
string $key,
mixed $value = null,
mixed $defaultValue = null,
bool $delete = false,
bool $take = false
)
memorize(Closure $lambda, $paramsHash = null)
cookie(string $name)
var_dump
.pre($value)
console_log(...$messages)
pass_hash($password, int $cost = 10)
pass_hash
helper or the PHP Secure Password component.pass_verify($password, string $hash)
reflection_get_attributes(object|string $class_name, string|null $method, string $attribute_name)
reflection_get_property(string|object $class, string $property)
reflection_extension_info(string $extension_name)
reflection_new_instance(object|string $objectOrClass, ...$args)
reflection_instance_without_construct(object|string $objectOrClass)
reflection_invoke_method(object|string $objectOrClass, string $method, ...$args)
url(?string $name = null, $parameters = null, ?array $getParams)
input(string $index = null, string $defaultValue = null, ...$methods)
to_route(string $url, ?int $code = null)
get_url(string $uri = null)
middleware(string $value)
request()
response()
request_limit(string $key, int $limit = 5, int $seconds = 60)
request_repeat(string $key, string $value)
remove_param()
get_client_ip(?bool $header_containing_ip_address = null)
is_https()
is_ajax()
See Wolf Template to use Wolf helpers.
public/assets/_css/
folder.load_css(string $asset)
minify()->style()
method.load_min_css()
public/assets/_js/
folder.load_js(string $asset)
minify()->script()
method.load_min_js()
public/assets/_img/
folder.load_img(string $asset)
public/assets/
folder.load_file(string $asset)
extend(string $view)
conditional(string $needle, bool $value)
csrf_token()
spoofing(string $method)
ServiceContainer
class.container(string $container_name)