bogdik/yii2-oci8

Oci8 Driver for Yii2

Installs: 44

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 14

Type:yii2-extension

1.2.5 2018-05-15 15:46 UTC

This package is not auto-updated.

Last update: 2024-05-02 03:15:43 UTC


README

Installation

Install With Composer

The preferred way to install this extension is through composer.

Either run

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

or add

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

to the require section of your composer.json file.

OR Install From Archive

You can also install from archive. Add aliase on config file to point alias to the folder

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

Usage

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

return [	
	'components' => [
		....
		'db' => [
                    'class' => 'bogdik\oci8\Oci8DbConnection',
                    'dsn' => 'oci8:dbname=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=xe)));charset=AL32UTF8;',
                    'username' => 'yourdatabaseschemaname',
                    'password' => 'databasepassword',
                    'attributes' => []
                ],
	],
];

Custom User's Table Migration

You may want to create user's table using migration command. Instead of using yii default migrate (yii migrate), specify the custom migrationPath to point to custom user's table migration to avoid oracle error ('ORA-00907: missing right parenthesis). Note: you have to manually add user's table sequence eg. user_seq on you oracle db and primary key trigger using sql developer or toad.

yii migrate --migrationPath=@bogdik/oci8/migrations

You can refer the sample application using yii2 advance template here bogdik/yii2-php7-oci8 https://github.com/bogdik/yii2-php7-oci8