PHPackages                             mehdirochdi/php-crud - 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. [Database &amp; ORM](/categories/database)
4. /
5. mehdirochdi/php-crud

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

mehdirochdi/php-crud
====================

This class provides a common method of performing simple CRUD operations on any database supported by PHP PDO

3231PHP

Since Feb 19Pushed 10y ago1 watchersCompare

[ Source](https://github.com/mehdirochdi/php-crud-V2)[ Packagist](https://packagist.org/packages/mehdirochdi/php-crud)[ RSS](/packages/mehdirochdi-php-crud/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP CRUD PDO-V2
===============

[](#php-crud-pdo-v2)

PHP CRUD Lib 2.0 - 9 April 2015

By Mehdi Rochdi

PHP Class/MySQL use, create, all, update and delete and other functions. It uses PDO driver it's capable to interacting with your mysql database, with easy methods inspire since framworks (cakePHP). you can integrate into you OOP architecture

### Installation

[](#installation)

---

Clone the repository

```
git clone https://github.com/mehdirochdi/php-crud-V2.git

```

Download composer:

```
curl -sS https://getcomposer.org/installer | php

```

Install vendors:

```
php composer.phar install

```

### How Using The Class

[](#how-using-the-class)

---

You will need to change some variable in config.php, for your own Database local and a distance

```
"db_host" => "localhost", // change as required
"db_user" => "username",  // change as required
"db_pass" => "password",  // change as required
"db_name" => "database_name", // change as required
```

Test Mysql

Start by creating test table in your Database

```
CREATE TABLE IF NOT EXISTS `authors` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `emails` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

INSERT INTO posts VALUES('', 'Name 1', 'name 1@email.com');
INSERT INTO posts VALUES('', 'Name 2', 'name 2@email.com');
INSERT INTO posts VALUES('', 'Name 3', 'name 3@email.com');
INSERT INTO posts VALUES('', 'Name', 'name 4@email.com');
```

### Examples

[](#examples)

---

###### Insert exemple

[](#insert-exemple)

```
