PHP code example of royvermeulen / entify

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

    

royvermeulen / entify example snippets

 


$config = [
    'entities' => [
        'Src\\Entities' => 'src/entities'
    ],

    'schema' => '',
    'default-data' => '',
    
    'database-connection' => [
        'DB_HOST' => '',
        'DB_USER' => '',
        'DB_PASS' => '',
        'DB_NAME' => '',
        'DB_PORT' => 3306
    ]
];

return $config;



rc\Entities\Notes;
use Src\Entities\Usernotes;
use Src\Entities\Users;

$users = new Users();
$users->setUsername('admin');
$users->setPassword(password_hash('admin', PASSWORD_DEFAULT));
$users->create();

$note = new Notes();
$note->setTitle('Note 1');
$note->setContent('Content 1');
$note->create();

$userNote = new Usernotes();
$userNote->setUser_id($users->getId());
$userNote->setNote_id($note->getId());
$userNote->create();