PHP code example of nwidart / laravel-normalizer

1. Go to this page and download the library: Download nwidart/laravel-normalizer 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/ */

    

nwidart / laravel-normalizer example snippets

 php
use Nwidart\LaravelNormalizer\Contracts\Normalizer;

final class CustomNormalizer implements Normalizer
{
    /**
     * Normalize the given data
     * @param array $data
     * @return array
     */
    public function normalize(array $data)
    {
        if (array_key_exists('name', $data)) {
            $data['name'] = strtoupper($data['name']);
        }

        return $data;
    }
}
 php
public function create($data)
{
    $data = $this->model->normalize($data);

    return $this->model->create($data);
}