PHP code example of octacondeveloper / php-orm

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

    

octacondeveloper / php-orm example snippets


use PhpOrm\Query;

$result  = Query::table('users')->all();

use PhpOrm\Model;

class User extends Model {

    //this is optional if your table name differs from the class name
    protected $table = 'users';
}

use `Your-class-namespace`

$result  = User::all();
bash
  composer 



$result  = User::count();
$result  = User::count('sex','male');



$result  = User::withOne('files','user_id','id')->first();
$result  = User::withOne('files','user_id','id')->all();



$result  = User::withOne('files','user_id','id')->first();
$result  = User::withOne('files','user_id','id')->all();