2017 © Pedro Peláez
 

yii2-extension yii2-oci8

Oci8 Driver for Yii2

image

apaoww/yii2-oci8

Oci8 Driver for Yii2

  • Tuesday, July 24, 2018
  • by apaoww
  • Repository
  • 1 Watchers
  • 7 Stars
  • 4,726 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 10 Forks
  • 1 Open issues
  • 1 Versions
  • 7 % Grown

The README.md

Yii2 Connect Oracle via OCI8

This library is based on yajra/pdo-via-oci8 Version 3 that support PHP 8.2., (*1)

Installation

Install With Composer

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require apaoww/yii2-oci8 "dev-master"

or add, (*4)

"apaoww/yii2-oci8": "dev-master"

to the require section of your composer.json file., (*5)

OR Install From Archive

You can also install from archive. Add aliase on config file to point alias to the folder, (*6)

return [
    ...
    'aliases' => [
        '@apaoww/oci8' => 'path/to/your/extracted',
        ...
    ]
];

Usage

Once the extension is installed, simply modify your application configuration on main-local.php as follows :, (*7)

return [    
    'components' => [
        ....
        'db' => [
                    'class' => 'apaoww\oci8\Oci8DbConnection',
                    'dsn' => 'oci:dbname=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=xe)));charset=AL32UTF8;',
                    'username' => 'yourdatabaseschemaname',
                    'password' => 'databasepassword',
            'enableSchemaCache' => true, //increase performance when retrieved table meta data
                    'schemaCacheDuration' => 3600,
                    'schemaCache' => 'cache',
            'on afterOpen' => function($event) {

                /* A session configuration example */
                $q = <<<SQL
begin
  dbms_session.set_role('NAME_OF_YOUR_ROLE_IN_ORACLE');
  EXCEPTION  -- exception handlers begin
   WHEN OTHERS THEN  -- handles all other errors
      ROLLBACK;
end;
SQL;
                $event->sender->createCommand($q)->execute();
            },
                    // To convert column name to lower case
                    'schemaMap' => ['oci' => 'apaoww\oci8\ESchemaOci',],
                'attributes' => [
    //                PDO::ATTR_STRINGIFY_FETCHES => true,
                    PDO::ATTR_CASE => PDO::CASE_LOWER,
                ],
                    ],
    ],
];

The Versions

24/07 2018

dev-master

9999999-dev

Oci8 Driver for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Apa Oww

yii oci8