PHP code example of oilytortoise / laravel-simple-dto
1. Go to this page and download the library: Download oilytortoise/laravel-simple-dto 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/ */
oilytortoise / laravel-simple-dto example snippets
public function get(Model $model, string $key, mixed $value, array $attributes): mixed
{
$dataArray = json_decode($value, true);
return new UserConfigDto($dataArray);
}
public function set(Model $model, string $key, mixed $value, array $attributes): mixed
{
$dataArray = $value->toArray();
return json_encode($dataArray, JSON_UNESCAPED_SLASHES);
}