$config = new Config(); $config['database.host'] = 'localhost'; $config['database.username'] = 'username'; $config['database.password'] = 'password'; $config['database.name'] = 'db_name'; $db = new PDO( 'mysql:host=' . $config['database.host'] . ';dbname=' . $config['database.name'], $config['database.username'], $config['database.password'] );
$config = new Config(); $config['mail.host'] = 'smtp.gmail.com'; $config['mail.port'] = 587; $config['mail.username'] = 'your-email@gmail.com'; $config['mail.password'] = 'your-email-password'; $mailer = new PHPMailer\PHPMailer\PHPMailer; $mailer->isSMTP(); $mailer->Host = $config['mail.host']; $mailer->Port = $config['mail.port']; $mailer->SMTPAuth = true; $mailer->Username = $config['mail.username']; $mailer->Password = $config['mail.password'];In this example, the Config library is used to store details for an SMTP email server. The PHPMailer library is then used to send emails using these settings. The package library used in this example is likely the PHPMailer library.