1. Go to this page and download the library: Download apaoww/yii2-oci8 library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
apaoww / yii2-oci8 example snippets
php composer.phar
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,
],
],
],
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.