PHP code example of levkopo / dbpp

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

    

levkopo / dbpp example snippets


class SimpleDatabase extends Database {

}

class TableDao extends Dao {

}

class TableDao extends Dao {
    #[Query("SELECT * FROM `table`")
    public function getAll(): array|false {
        parent::getAll();
    }
    
    #[Query("SELECT * FROM `table` WHERE `id` = :id")
    public function getById(int $id){
        parent::getAll($id);
    }
    
    #[Insert("table")
    public function insert(Value $value): bool{
        parent::insert($value);
    }
}

class SimpleDatabase extends Database {
   public TableDao $table;
}

$pdo = new PDO(*data*);
$database = new SimpleDatabase();
DBPP::init($database, $pdo);