Giter Club home page Giter Club logo

pdooci's Introduction

PDOCI

โš ๏ธ WARNING This software is abandonware. As the creator and maintainer, I don't even use PHP or Oracle for years, so, I can't support it anymore. It should work ok for PHP untill version 7, but seems that with 8.1 there are some alerts. Feel free to fork it and keep it going.

Wrapping on PHP OCI functions to simulate a PDO object, using just pure PHP and the oci_* functions.

Let's face it. Installing PHP, PDO, Oracle drivers and PDO OCI is not a pleasant task. Is more pleasant to insert bamboo sticks under your fingernails than make all the voodoo needed to accomplish that task. And there are two big problems with that:

  1. If you install pdo_oci with pecl you'll get a version from 2005 (http://pecl.php.net/package/PDO_OCI). Even Christian Bale is now far from the things from 2005, and wow, he had a cool suit and a very nice car. And all came in black.

  2. If you follow the official docs, you'll need to compile PHP and still get an experimental extension (http://www.php.net/manual/ref.pdo-oci.php). Come on. We can't (yeah, we know how to do it!) compile PHP on every server we need and just for an experimental feature?

That's why I made PDOOCI.

Installation

First install the Oracle drivers (I like the instant client versions) and the oci8 package (with pecl, this one seems to be updated often).

With Composer

$ composer require taq/pdooci
{
    "require": {
        "taq/pdooci": "^1.0"
    }
}
<?php
require_once 'vendor/autoload.php';

$pdo = new PDOOCI\PDO("mydatabase", "user", "password");

Without Composer

Why are you not using composer? Download the src folder from the repo and rename it to PDOOCI, then require the PDOOCI/PDO.php file.

require_once "PDOOCI/PDO.php";

$pdo = new PDOOCI\PDO("mydatabase", "user", "password");

Yeah, the rest should work exactly the same as if you were using a PDO object. :-)

Testing

There is a test suite (using PHPUnit with a version bigger than 6.x) on the test directory. If you want to test (you must test your code!), create a table called people with two columns:

  1. name as varchar2(50)
  2. email as varchar2(30)

And some environment variables:

  1. PDOOCI_user with the database user name
  2. PDOOCI_pwd with the database password
  3. PDOOCI_str with the database connection string

Don't forget to run composer install!

And then go to the test dir and run PHPUnit like:

phpunit --colors .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.