New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

adirona/pdo-connection

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adirona/pdo-connection

Simple PHP library to make PDO connection

Source
Packagist
Version
dev-master
Version published
Total downloads
2
Maintainers
1
Created
Source

PDO Connection Wrapper With PHP

This is a simple PHP library for PDO connection

Installation

Install library via composer :

composer require adirona/pdo-connection

How to use this library

Initialize Connection Class

Connection class accepts 2 arrays in it's constructor first one is DSN settings and the second one is for connection options and third attribute is which PDO driver do you want to use for connection default is MYSQL. You can check PDO Drivers https://www.php.net/manual/en/pdo.drivers.php or using SupportedPDODatabaseDrivers() method

$DatabaseInstance = new Connection([
    'host' => 'localhost',
    'database_name' => 'db_name',
    'username' => 'root',
    'password' => '',
    'charset' => 'utf8'
],[
    PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
    PDO::ATTR_EMULATE_PREPARES   => false,
], 'mysql');

Connect Now
$ConnectDatabase = $DatabaseInstance->connect();

To get most of this PDO wrapper and PDO in general use also this repository (https://github.com/envms/fluentpdo).

You can find same example at examples folder of this repository.

Keywords

php

FAQs

Package last updated on 17 Oct 2020

Related posts