PHP code example of sensorario / orma

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

    

sensorario / orma example snippets


$config = [
    'postgresql' => [
        'dns' => 'pgsql:host=database;dbname=your_database_name',
        'username' => 'your_username',
        'password' => 'your_password',
    ],
    'sqlite' => [
        'dns' => 'sqlite:./erdatabase',
    ],
    'db' => 'postgresql',
    'db' => 'sqlite',
];

$pdo = new PDO(
    $config[$config['db']]['dns'],
    $config[$config['db']]['username'],
    $config[$config['db']]['password'],
);

$orma = new Orma($pdo, match($driver) {
    'sqlite' => new SQLiteDriver,
    'postgresql' => new PostgreSQLDriver,
});

$orma($table)->createTable();

$orma->addColumn($column);

$orma->insert([ 'id' => 42, ]);

$orma->delete([ 'id' => 42, ]);

$orma->update([ 'foo' => 'bar', ], [ 'id' => 42, ]);