1. Go to this page and download the library: Download faso-dev/osc-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/ */
faso-dev / osc-orm example snippets
ERT USE
- ### With QUERY INSERT BUILDER
use FSDV\Builder\SelectBuilder;
$builer = new SelectBuilder();
try {
// select max(user_id) as last_user;
$query = $builer->max('user_id','last_user')->from('user')->getQuery()->getSQLQuery();
var_dump($query);
// select count(user_id) as count_user;
$query = $builer->count('user_id','count_user')->from('user')->getQuery()->getSQLQuery();
var_dump($query);
// select count(user_id) as total;
$query = $builer->avg('panier_price','total')->from('user')->getQuery()->getSQLQuery();
var_dump($query);
// select count(user_id) as somme;
$query =$builer->sum('panier_price','somme')->from('user')->getQuery()->getSQLQuery();
var_dump($query);
$query = $builer->select()
->from('user','post')
->where('user.id = post.user_id and post.title LIKE %:title%')
->setParameter('title', 'Mon super article')
->orderByAsc(['user.nom'])->getQuery()->getSQLQuery();
var_dump($query);
$query = $builer->select()
->from('user')
->lefJoin('post', 'post.user_id = user.id')
->where('post.title LIKE %:title%')
->setParameter('title', 'Mon super article')
->orderByDesc(['user.nom'])->getQuery()->getSQLQuery();
var_dump($query);
$query = $builer->select('username','mail','adresse')
->from('user')
->avg('achat')
->groupBy('username','mail','adresse')
->orderByAsc(['user.username'])->getQuery()->getSQLQuery();
;
var_dump($query);
$query = $builer->select('username','mail','adresse')
->from('user')
->paginate(200)
->orderByDesc(['user.mail'])->getQuery()->getSQLQuery();
;
var_dump($query);
} catch (Exception $e) {
echo $e->getMessage();
}
- UPDATE CASE
- ### WITH QUERY UPDATE BUILDER
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.