PHP code example of lemaur / laravel-typed-arr

1. Go to this page and download the library: Download lemaur/laravel-typed-arr library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lemaur / laravel-typed-arr example snippets


use \Illuminate\Support\Arr;

/** @var \Illuminate\Support\Stringable $myValue */
$myValue = Arr::string($data, 'my-value');

use \Illuminate\Support\Arr;

/** @var \Illuminate\Support\Stringable $name */
$name = Arr::string($data, 'name');

use \Illuminate\Support\Arr;

/** @var bool $archived */
$archived = Arr::boolean($data, 'archived');

use \Illuminate\Support\Arr;

/** @var int $count */
$count = Arr::integer($data, 'count');

use \Illuminate\Support\Arr;

/** @var float $amount */
$amount = Arr::float($data, 'amount');

use \Illuminate\Support\Arr;

/** @var \Carbon\Carbon $birthday */
$birthday = Arr::date($data, 'birthday');

use \Illuminate\Support\Arr;

/** @var \Carbon\Carbon $elapsed */
$elapsed = Arr::date($data, 'elapsed', '!H:i', 'Europe/Madrid');

use App\Enums\Status;
use \Illuminate\Support\Arr;

/** @var Status $status */
$status = Arr::enum($data, 'status', Status::class);