class Database { private $host = 'localhost'; private $username = 'root'; private $password = ''; private $database = 'mydb'; function __construct() { $this->conn = new mysqli($this->host, $this->username, $this->password, $this->database); if ($this->conn->connect_error) { die("Connection failed: " . $this->conn->connect_error); } } }In this code example, the __construct method is used to create a new mysqli database connection to a localhost server with the root username and no password, and select the 'mydb' database. This example does not use any package library as it is using the built-in php mysqli library.