PHP code example of mmerlijn / laravel-helpers

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

    

mmerlijn / laravel-helpers example snippets


Flash::message('Hello World')->type('noticee')->add();

//In YourModel.php

    protected $casts = [
        'phone' => Phone::class,
    ];

//setter => 0612345678
//getter => PhoneModel class

//methods
$model->phone->get(); // returns 06 1234 5678
$model->phone->set(); // returns 0612345678
$model->phone->smsPhone(); //returns +31612345678 or exception
$model->phone->withCountryCode('it'); //returns +39612345678

//In YourModel.php

    protected $casts = [
        'initials' => Initials::class,
    ];

//setter => BAR
//getter => B.A.R.

Validator::make([],[
  'bsn'=> [new Bsn]
]);

Validator::make([],[
  'request_nr'=> [new Requestnr]
]);

//with coordinates
Distance::from(52.4968, 5.0727)
    ->to(52.5144, 4.9641)
    ->get();
    
//with cities
Distance::from("Volendam")
    ->to("Purmerend")
    ->get();

//with coordinates
Flash::message('Hello World')
    ->type('success')
    ->duration(3000)
    ->add();

->get(unit:"m"); //distance in meter (default km)
->get(format:true) // 5,4 km

use AddressModelTrait;

$model->address->street;

use NameModelTrait;

$model->name->salutation; // Dhr. / Mevr.
$model->name->name; //Full name