Streams Core expands upon Laravel support utilities. These features both provide internal functionalities and can be easily integrated into your own work.
The following methods have been added to Laravel's array helper.
use Illuminate\Support\Arr;
Arr::make($target);
Convert the target recusively to array values. This method leverages toArray
and public propertis of objects to resolve arrays as well.
Arr::make($target);
Arr::make($collection);
Recusively parse an array of target values. This method leverages Arr::make()
to ensure an array target.
Arr::parse($target, $entry);
Arr::make($target, ['entry' => $entry]);
Converts array keys with dots to nested key values. This is the opposite of Laravel's Arr::dot() method.
$dotted = [
'foo.bar' => 'baz'
];
$undotted = Arr::undot($dotted);
array:1 [
"foo" => array:1 [
"bar" => "baz"
]
]
The following methods have been added to Laravel's string helper.
use Illuminate\Support\Str;
Str::humanize($value);
The parse
method parses the target string with the payload array using a dot notation.
$payload = [
'foo' => [
'bar' => 'baz',
],
];
// Example: baz
Str::parse('Example {foo.bar}', $payload);
// Hi Ryan
Str::parse('Hi {name}', $entry);
Vigurously cleanse the target value of any impure content or malicious intent.
$clean = Str::purify($dirty);
Humanize a string slug. This method returns all lowercase.
$segment = 'streams-platform_v2';
// streams platform v2
$title = Str::humanize($segment);
// Streams Platform V2
echo ucwords($title);
Parse a markdown string using the fantastic Parsedown package. You
$markdown = '#Hello';
// <h1>Hello</h1>
echo Str::markdown($markdown);
Wrap all URLs within target with links.
$urls = 'Example: https://streams.dev/docs';
// Example: <a href="https://streams.dev/docs">https://streams.dev/docs</a>
echo Str::linkify($urls);
Truncate a string value to a given length. A third end argument maybe be used to specify the string ending which defaults to "...".
$lengthy = 'My long winded introduction has to start with my childhood.';
// My long winded intro...
echo Str::truncate($lengthy, 20);
A blank TALL-stack Laravel project with Streams.
The fundamental features and utilities offered by the Streams platform.
A universal and extensible RESTful API for Streams.
Extensible, user-friendly, and performant control panel, components, and services.
Dev tooling for Laravel Streams.