Skip to content

A Connection.php class using Singleton design pattern and PDO, with a config.ini file;

Notifications You must be signed in to change notification settings

echart/SingletonPHPConnectionClass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

What is that?

A PHP Connection class, using singleton design pattern

This class use PDO to connect with a pgsql database, with a config.ini file to do that.

Example

The example is the index.php.

First you need include the class/Connection.php, than just call the static method getInstance like:

$con = Connection::getInstance();

If you already have an instance of Connection, the class will get that. If doesn't, the class will create a new object. Without duplications.

After that, you just need to call the connect() method and use PDO.

easy.

License

Free for use.

About

A Connection.php class using Singleton design pattern and PDO, with a config.ini file;

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages