setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected successfully"; } catch(PDOException $e) { echo "Connection failed: " . $e->getMessage(); }This example connects to a MySQL database using the provided server name, username, password and database name. It uses the try-catch block to handle any errors that may occur during the connection process. The package/library used for getDB function may vary depending on the project requirements. It could be a custom library, a third-party library like PDO or a framework-specific library like Laravel's Eloquent ORM.