Downloads
Stars
Version
laravel-dbmaker is a DBMaker service provider for Laravel. It provides DBMaker Connection by extending the Illuminate Database component of the laravel framework.
composer require dbmaker/laravel-odbc
To add source in your project
We suggest using the libary we build
php -m
Check if the installation was successfulyou can follow this step
# wget https://github.com/dbmaker-go/php_ext/releases/download/1.0.0/php_dbmaker-5.4-7.3-Linux2_x86_64.tgz
# tar zxvf php_dbmaker-5.4-7.3-Linux2_x86_64.tgz
# mv php_dbmaker/bundle/pdo_odbc.ini /etc/php.d/20-pdo-odbc.ini
# mv php_dbmaker/bundle/pdo_odbc.so /usr/lib64/php/modules/pdo-odbc.so
# php -m
Note: If your default installation directory of DBMaker standard is not /home/dbmaker/5.4
or bundle is not /opt/dbmaker
, please add installation directory to LD_LIBRARY_PATH environment variable.
It's very simple to configure:
1) Add database to database.php file
'dbmaker' => [
'driver' => 'odbc',
'dsn' => 'odbc:DSN=DBNAME',
'database' => 'DBNAME',
'host' => 'localhost',
'username' => 'username',
'password' => 'password',
'options' => [
'idcap' => 1 //please set the value same as your server db_idcap
]
]
2) set default database to dbmaker
'default' => 'dbmaker',
3) testing
# php artisan make:command MyCommand
# vi app/Console/Commands/MyCommand.php
find
protected $signature = 'command:name';
change to
protected $signature = 'my:command';
and add test code
public function handle()
{
$data= \DB::table('TA1')->get('C1');
print_R($data);
}
# vi app/Console/Kernel.php
protected $commands = [
// ...
Commands\MyCommand::class, //add this
];
run
# php artisan my:command
Consult the Laravel framework documentation