PHPackages                             sujanshresthanet/pdo-wrapper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. sujanshresthanet/pdo-wrapper

ActivePdo-extension

sujanshresthanet/pdo-wrapper
============================

PDO Wrapper

10PHP

Since Jun 7Pushed 3y ago1 watchersCompare

[ Source](https://github.com/sujanshresthanet/pdo-wrapper)[ Packagist](https://packagist.org/packages/sujanshresthanet/pdo-wrapper)[ RSS](/packages/sujanshresthanet-pdo-wrapper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/b7cce375f5d7b3a0524f804e20d7eb0e17678cdc79f822ed23ea47f77919a43a/687474703a2f2f706f7365722e707567782e6f72672f73756a616e73687265737468616e65742f70646f2d777261707065722f76)](https://packagist.org/packages/sujanshresthanet/pdo-wrapper) [![Total Downloads](https://camo.githubusercontent.com/99fb83e7417688cde08b0da34cd5072e03f2309122e42dc866e15b504ef9ff1c/687474703a2f2f706f7365722e707567782e6f72672f73756a616e73687265737468616e65742f70646f2d777261707065722f646f776e6c6f616473)](https://packagist.org/packages/sujanshresthanet/pdo-wrapper) [![Latest Unstable Version](https://camo.githubusercontent.com/5d2767d05ed856642ee8579d98ce9ba7e6f3bfcce1cef905cab9b7d568355302/687474703a2f2f706f7365722e707567782e6f72672f73756a616e73687265737468616e65742f70646f2d777261707065722f762f756e737461626c65)](https://packagist.org/packages/sujanshresthanet/pdo-wrapper) [![License](https://camo.githubusercontent.com/83bb686c853f40d04ed4dafbb583d04848b918249e86e5eaee546c32b7a00718/687474703a2f2f706f7365722e707567782e6f72672f73756a616e73687265737468616e65742f70646f2d777261707065722f6c6963656e7365)](https://packagist.org/packages/sujanshresthanet/pdo-wrapper) [![PHP Version Require](https://camo.githubusercontent.com/c45870bca030d50b987c5d397fdf50860b263cf6bde833cec5954d6349f54749/687474703a2f2f706f7365722e707567782e6f72672f73756a616e73687265737468616e65742f70646f2d777261707065722f726571756972652f706870)](https://packagist.org/packages/sujanshresthanet/pdo-wrapper) [![Dependents](https://camo.githubusercontent.com/f34eb2404d51f65798f4b4123af34917c4ae592accc4e5887362aa1cd23c7c60/687474703a2f2f706f7365722e707567782e6f72672f73756a616e73687265737468616e65742f70646f2d777261707065722f646570656e64656e7473)](https://packagist.org/packages/sujanshresthanet/pdo-wrapper)

PDO Database Class
==================

[](#pdo-database-class)

#### 1. Add via composer :

[](#1-add-via-composer-)

```
composer require sujanshresthanet/pdo-wrapper

```

#### 2. Extend your class db and your object model :

[](#2-extend-your-class-db-and-your-object-model-)

```
#Create class MyDb for example and extends from \sujanshresthanet\pdo\Db.
#To use the class
#if you want object model from table mysql you can use like these following class Persons with extends from Crud

require(__DIR__ . './config/database.php');

class MyDb extends \sujanshresthanet\pdo\Db {

    public function __construct() {
        parent::__construct(HOST, DB_NAME, DB_USER, DB_PASS);
    }
}

//create class Persons if we want
class Persons extends sujanshresthanet\pdo\Crud {

    protected $table = 'persons';

    # Primary Key of the table
    protected $pk = 'id';

    public $className = 'MyDb';

}
```

#### 3. Bootstraping in your project example in index.php

[](#3-bootstraping-in-your-project-example-in-indexphp)

```
