PHP code example of programster / orm-generator

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

    

programster / orm-generator example snippets


$db = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
$generator = new \Programster\OrmGenerator\MySqlGenerator($db, __DIR__ . '/output');
$generator->run();

$connString =
    "host=" . DB_HOST
    . " dbname=" . DB_NAME
    . " user=" . DB_USER
    . " password=" . DB_PASSWORD
    . " port=" . DB_PORT
    . " options='--client_encoding=UTF8'";

$db = pg_connect($connString);

if ($db == false)
{
    throw new Exception("Failed to initialize database connection.");
}

$generator = new \Programster\OrmGenerator\PgSqlGenerator($db, __DIR__ . '/output');
$generator->run();