PHP code example of larsmbergvall / utilities-for-laravel
1. Go to this page and download the library: Download larsmbergvall/utilities-for-laravel 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/ */
larsmbergvall / utilities-for-laravel example snippets
/** @var Result<array, string> $result */
// $result = Result::ok(['value' => 'foo']);
$result = Result::err('something went wrong');
$result->match(
ok: fn(array $data) => dd($data),
err: fn(string $error) => dd($error)
);
// $data = $result->getValue();
$error = $result->getErr();
shell
php artisan vendor:publish --tag=utilities-for-laravel-stubs
shell
php artisan vendor:publish --tag=utilities-for-laravel-config