We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 10da762 commit 18a8887Copy full SHA for 18a8887
example/db_config.php
@@ -0,0 +1,38 @@
1
+<?php
2
+
3
+use Dotenv\Dotenv;
4
+use React\EventLoop\Loop;
5
+use Saraf\QB\QueryBuilder\Core\DBFactory;
6
+use Saraf\QB\QueryBuilder\Facades\Database;
7
8
+$loop = Loop::get();
9
10
+// Environments
11
+$env = Dotenv::createImmutable(__DIR__ . "/../");
12
+$env->load();
13
14
+// Env Loader
15
+$DB_NAME = $_ENV['DB_NAME'];
16
+$DB_USER = $_ENV['DB_USER'];
17
+$DB_PASS = $_ENV['DB_PASS'];
18
+$DB_HOST = $_ENV['DB_HOST'];
19
+$DB_PORT_READ = $_ENV['DB_PORT_READ'];
20
+$DB_PORT_WRITE = $_ENV['DB_PORT_WRITE'];
21
22
23
24
+Database::initConnection(
25
+ new DBFactory(
26
+ $loop,
27
+ $DB_HOST,
28
+ $DB_NAME,
29
+ $DB_USER,
30
+ $DB_PASS,
31
+ $DB_PORT_WRITE,
32
+ $DB_PORT_READ,
33
+ 5,
34
35
+ 2,
36
+ 2
37
+ )
38
+);
0 commit comments