---
title: Helpers
---

# Helpers

<div class="documentation__toc"></div>

## Introduction

The Streams Platform includes a variety of global "helper" PHP functions. Many of these functions are used by the platform itself; however, you are free to use them in your own applications if you find them convenient.

This documentation assumes you are familiar with [Laravel helpers](https://laravel.com/docs/helpers).

### app\_storage\_path

The `app_storage_path` function returns the fully qualified path to the application's unique storage directory. You may also use the app_path function to generate a fully qualified path to a file relative to the application directory:

```php
$path = app_storage_path();

$path = app_storage_path('addons/redirects/routes.php');
```

### str_humanize

The `str_humanize` function returns humanized `string`.

```php
str_humanize('example_slug');
// example slug

str_humanize('ExampleClass');
// example class
```

### parse

The `parse` function returns a parsed `string` using simple dot value parsing.

```php
parse($string, $data);

echo parse('Welcome {username}', $user);
```

> The `parse` **Twig** function simulates `render` function below.

### render

The `render` function returns a rendered `template` string with optional `payload` data using the view engine.

```php
render($template, $payload);

echo render('Welcome {{ user().username }}');
```

### filesize\_for\_humans

The `filesize_for_humans` function returns the provided `bytes` as a human readable filesize string.
 
 ```php
 filesize_for_humans($bytes, $decimals = 2)
 
 echo filesize_for_humans(5000000, 1);
 // 500 kB
 ```

### console

The `console` function returns the CLI console instance.
 
 ```php
 console()->info('Why hello there.');
 ```

### decorate

The `decorate` function decorates the `target` object or returns it as is if already decorated.
 
 ```php
 $presenter = decorate($target);
 ```

### undecorate

The `undecorate` function undecorates the `target` object or returns it as is if already decorated.
 
 ```php
 $object = undecorate($target);
 ```
