host = 'localhost'; $this->port = intval(getenv('MYSQL_PORT')); $this->user = getenv('MYSQL_USER'); $this->pass = getenv('MYSQL_PASSWORD'); $this->createConn(); } private function createConn(): void { $this->mysqli = new mysqli($this->host . ":" . $this->port, $this->user, $this->pass, $this->dbName); } public function query($sql): mysqli_result|bool { return $this->mysqli->query($sql); } public function changeDB($dbName): void { $this->dbName = $dbName; $this->mysqli->select_db($dbName); } public function __destruct() { $this->mysqli->close(); } }