PHP Classes

Simple PHP Model Class: Store and retrieve objects in databases using PDO

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 155 All time: 9,006 This week: 194Up
Version License PHP version Categories
simplemodel 1.0.0The PHP License5PHP 5, Databases, Design Patterns


This package can store and retrieve objects in databases using PDO.

It provides a base class that can be extend by implementation model classes that can perform several types of operations with objects that are stored in a database accessed using the PDO extension.

Currently the base model class can:

- Establish hasOne and hasMany relationships with other model classes
- Manage transactions
- Find or count objects that match given conditions
- Save or delete objects
- Retrieve existing model structure reading a given database schema
- Access class properties using getter and setter functions
- Etc..

Picture of SzpaQ
  Performance   Level  
Name: SzpaQ <contact>
Classes: 5 packages by
Country: Poland Poland
Age: ???
All time rank: 302771 in Poland Poland
Week rank: 341 Up8 in Poland Poland Up


 * @author ?ukasz Szpak ( )
 * @Copyright 2018 SzpaQ
 * */

require_once 'self_stand/Model.php';
Users extends Model {
    public function
$this->hasMany('user_id', 'Task');
Task extends Model {
    public function


'host' => 'localhost',
'name' => 'dev_crm',
'user' => 'szpak',
'pass' => 'x',
'charset' => 'utf8',
'prefix' => 'sh_',

$user = Users::findFirst(2);
$task = new Task;
$user -> username = 'SzpaQ';
Model::commit(); // Transaction won't be committed since task wont be save. It suppose to have few properties like user_id, name

  Files folder image Files  
File Role Description
Files folder imageself_stand (1 file)
Accessible without login Plain text file test_model.php Example Example script

  Files folder image Files  /  self_stand  
File Role Description
  Plain text file Model.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,006
This week:194Up