PHP code example of zoon / petrovich-php
1. Go to this page and download the library: Download zoon/petrovich-php 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/ */
zoon / petrovich-php example snippets
$petrovich = new Petrovich(Petrovich::GENDER_MALE);
$firstname = "Александр";
$middlename = "Сергеевич";
$lastname = "Пушкин";
echo $petrovich->detectGender("Петровна"); // Petrovich::GENDER_FEMALE (см. пункт Пол)
echo '<br /><strong>Родительный падеж:</strong><br />';
echo $petrovich->firstname($firstname, Petrovich::CASE_GENITIVE).'<br />'; // Александра
echo $petrovich->middlename($middlename, Petrovich::CASE_GENITIVE).'<br />'; // Сергеевича
echo $petrovich->lastname($lastname, Petrovich::CASE_GENITIVE).'<br />'; // Пушкина
class User {
use Trait_Petrovich;
}
$user = new User();
$user->lastname = "Пушкин";
$user->firstname = "Александр";
$user->middlename = "Сергеевич";
$user->firstname(Petrovich::CASE_GENITIVE); // Пушкина
$user->lastname(Petrovich::CASE_GENITIVE); // Александра
$user->middlename(Petrovich::CASE_GENITIVE); // Сергеевича
bash
cd lib
git clone https://github.com/petrovich/petrovich-php.git petrovich-php
bash
git submodule add --init https://github.com/petrovich/petrovich-php.git lib/petrovich-php