-
Notifications
You must be signed in to change notification settings - Fork 0
00.Development
Muhammet ŞAFAK edited this page Nov 19, 2022
·
3 revisions
composer require initphp/database
use \InitPHP\Database\Facade\DB;
DB::createImmutable([
'dsn' => '',
'username' => 'root',
'password' => '',
]);
Defines whether the executed SQL statement will be thrown when an error occurs.
use \InitPHP\Database\Facade\DB;
DB::createImmutable([
'dsn' => '',
'username' => 'root',
'password' => '',
'debug' => true,
]);
If you want to log when an error occurs, you must provide this information at the time of connection.
use \InitPHP\Database\Facade\DB;
DB::createImmutable([
'dsn' => '',
'username' => 'root',
'password' => '',
'debug' => true,
'log' => __DIR__ . '/logs/{date}.log',
]);
Currently, 3 different logging are supported.
- File Log; If you specify the file path as a string; logs are tried to be written into the relevant file. You can define variable values such as
{year}
,{month}
,{day}
,{hour}
,{minute}
,{second}
,{date}
in the file path. - PSR-3 Logger Object; If you define a PSR-3 logger object; A call is made to the
critical()
method. -
\Closure
Logger; You can use your own custom method as logger.