PHP code example of basemotive / phersist

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

    

basemotive / phersist example snippets


$user = new User();
$user->email = '[email protected]';
$user->password = password_hash('secret', PASSWORD_DEFAULT);
$user->name = 'Joe Example';
$user->commit();

echo "User created: {$user->name}\n";

use PHersist\ObjectFinder;

$user = ObjectFinder::create(User::class)
	->where('email', '=', '[email protected]')
	->fetchOne();

echo "User retrieved: {$user->name}\n";