PHPackages                             giovanniramos/pdo4you - 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. giovanniramos/pdo4you

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

giovanniramos/pdo4you
=====================

Access SQL databases using the PDO extension

4.4(12y ago)7311530[3 issues](https://github.com/giovanniramos/PDO4You/issues)[2 PRs](https://github.com/giovanniramos/PDO4You/pulls)MITPHPPHP &gt;=5.3.2CI failing

Since Sep 13Pushed 2mo ago12 watchersCompare

[ Source](https://github.com/giovanniramos/PDO4You)[ Packagist](https://packagist.org/packages/giovanniramos/pdo4you)[ Docs](https://github.com/giovanniramos)[ RSS](/packages/giovanniramos-pdo4you/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)Dependencies (1)Versions (8)Used By (0)

*[Leia a documentação em Português](https://github.com/giovanniramos/PDO4You/blob/master/README-pt.md)*

---

PDO4You
=======

[](#pdo4you)

[![Latest Stable Version](https://camo.githubusercontent.com/3e9ab49556b30629d61a8dabdbe497e3a4c72cf4ba608f35e04db3411dd36694/68747470733a2f2f706f7365722e707567782e6f72672f67696f76616e6e6972616d6f732f70646f34796f752f762f737461626c652e706e67)](https://packagist.org/packages/giovanniramos/pdo4you)[![Build Status](https://camo.githubusercontent.com/1955a1c3579855cd174ecba5582829a233a1babfd3120021164e2bf2a090e974/687474703a2f2f696d672e736869656c64732e696f2f7472617669732d63692f67696f76616e6e6972616d6f732f50444f34596f752e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/giovanniramos/PDO4You "Check this project's build status on TravisCI")[![Gittip donate button](https://camo.githubusercontent.com/42e5e631d1b476782913aaf74e46f6c958ff0b496f2cb761d7d3716b3dacd4c8/687474703a2f2f696d672e736869656c64732e696f2f6769747469702f67696f76616e6e6972616d6f732e706e67)](https://www.gittip.com/giovanniramos "Donate weekly to this project using Gittip")[![Flattr donate button](https://camo.githubusercontent.com/3be700f407176b3b27df8f19c44f5627ca8b6d5f8a45a89f729ceb7655adda30/687474703a2f2f696d672e736869656c64732e696f2f666c617474722f646f6e6174652e706e673f636f6c6f723d79656c6c6f77)](https://flattr.com/profile/giovanniramos "Donate monthly to this project using Flattr")[![PayPal donate button](https://camo.githubusercontent.com/cee605d310278e18e854dd4974ecb7733ff261315962ddafb43f6bbfe27261bc/687474703a2f2f696d672e736869656c64732e696f2f70617970616c2f646f6e6174652e706e673f636f6c6f723d79656c6c6f77)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=L2TJHDN263VWU "Donate once-off to this project using Paypal")

This class is based on the PDO, which is a PHP extension that allows developers to create portable code, so as to cater for most popular databases. Being MySQL, PostgreSQL, SQLite, Oracle, Microsoft SQL Server, Sybase.

Alternatively been added in version 3.0 support for the MariaDB database. MariaDB is being considered as the future replacement free of MySQL. More information at:

And since version 2.6 also has provided support for the CUBRID database. A management system database highly optimized for Web applications. More information at:

The PDO4You provides an abstraction layer for data access, that regardless of which database you're using, you can always use the same methods to issue queries and fetch data.

The Singleton design pattern was adopted to optimize the connection, ensuring a single instance of the connection object.

### What is the advantage in their use?

[](#what-is-the-advantage-in-their-use)

- Instruction SQL compact using JSON notation
- Abstraction of connection
- Protection against SQL Injection
- Multiple database connections
- Methods/Commands CRUD predefined
- Option to connect with VCAP\_SERVICES
- Error Handling with Stack Trace

Getting Started
---------------

[](#getting-started)

The bootstrap file is responsible for loading the autoloader and all project dependencies. If not available, you will receive a confirmation message to start installation with Composer.

```

```

`PDO4You.php`: class that contains the implementation of the PDO object connection.

`PDO4You.config.php`: initial configuration file, server access and database.

`PDO4You.settings.ini`: contains the settings for each adapter of connection to the database.

`Describe.php`: Describe is a class used to list all the fields in a table and the data format of each field.

`Pagination.php`: Pagination is a class that allows you to list the records so as paged, similar to Google.

Establishing a connection to the database
-----------------------------------------

[](#establishing-a-connection-to-the-database)

To abstract our data access mechanisms, we use a DSN (Data Source Name = Data Source) that stores the information needed to initiate communication with other data sources, such as: type of technology, server name or location, database name, user, password, and other settings. This allows portability of the project, facilitating the exchange of access to the database during a migration.

```
