PHP code example of human018 / smart-name

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

    

human018 / smart-name example snippets


use Human018\SmartName\Traits\SmartNameTrait;

class User {
    use SmartNameTrait;
}

$user->name = "Mr John Doe";

// Will perform the following:

$user->title = "Mr";
$user->first_name = "John";
$user->last_name = "Doe";

$user->name; // returns "Mr John Doe";

$user->name = "[email protected]"

// Will perform the following:

$user->first_name = "john";