PHP code example of laravel-enso / helpers

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

    

laravel-enso / helpers example snippets


use LaravelEnso\Helpers\Services\Decimals;

$gross = Decimals::add('100.25', '19.75');
$vat = Decimals::mul('100', '0.19', 4);

use LaravelEnso\Helpers\Services\JsonReader;

$data = (new JsonReader($path))->array();
$obj = (new JsonReader($path))->obj();

use LaravelEnso\Helpers\Services\PriceComputor;

$total = (new PriceComputor('100'))
    ->quantity('2')
    ->discountPercent('10')
    ->vatPercent('19')
    ->total();

use Illuminate\Foundation\Http\FormRequest;
use LaravelEnso\Helpers\Traits\ToSnakeCase;

class StoreCompany extends FormRequest
{
    use ToSnakeCase;
}

use Illuminate\Http\Resources\Json\JsonResource;
use LaravelEnso\Helpers\Traits\GuardRelationLoad;

class Project extends JsonResource
{
    use GuardRelationLoad;

    public function toArray($request): array
    {
        $flow = $this->guardRelationLoad($this->resource, 'flow');

        return [
            'flow' => $flow->name,
        ];
    }
}

$attributes = $request->safe()->except('roles');