PHP code example of nyoncode / laravel-czech-names

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

    

nyoncode / laravel-czech-names example snippets


use NyonCode\CzechNames\Facades\CzechNames;

CzechNames::salutation('Ondřej Nyklíček');            // Dobrý den, Ondřeji,
CzechNames::salutation('Petra Nováková', 'informal'); // Ahoj, Petro,
CzechNames::salutation(null);                         // Dobrý den,

CzechNames::decline('Ondřej Nyklíček', 3);            // Ondřejovi Nyklíčkovi
CzechNames::vocative('Ing. Marek Dvořák');            // Marku

CzechNames::salutation(CzechNames::name('Saša Novák', 'masculine'));
CzechNames::name('Saša Novák', vocative: 'Sašo');

use NyonCode\CzechNames\Contracts\Addressable;
use NyonCode\CzechNames\Enums\Gender;

class Contact extends Model implements Addressable
{
    public function salutationName(): ?string { return $this->name; }
    public function salutationGender(): Gender { return Gender::Unknown; }
    public function salutationOverride(): ?string { return $this->vocative; }
}

CzechNames::salutation($contact);   // Dobrý den, Ondřeji,