PHP code example of litvinenko / object

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

    

litvinenko / object example snippets


class User extends Litvinenko\Common\Object
{
    protected $dataRules = array(
        'login'   => '

$user = new User([
    'login'   => null,
    'email'   => '[email protected]',
    'user_id' => 'not_number',
]);
echo ($user->isValid()) ? "User is valid\n" : "User is invalid\n";

print_r($user->getValidationErrors());