blob: b5360790bfc0a5cce41b7bf5700e35d7b22d1c5e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<?php
namespace App;
class DB
{
use Singleton;
private \PDO $connection;
public function __construct()
{
$driver = $_ENV['DB_DRIVER'] ?? 'pgsql';
$host = $_ENV['DB_HOST'] ?? 'localhost';
$port = $_ENV['DB_PORT'] ?? 5432;
$dbname = $_ENV['DB_NAME'];
$user = $_ENV['DB_USER'];
$password = $_ENV['DB_PASSWORD'];
$this->connection = new \PDO("$driver:host=$host;port=$port;dbname=$dbname", $user, $password);
}
}
|