<?php

class Conexion {
  static public function conectar() {

    $servername = "ARGSANSQLP1";
    $database = "proyectos";
    $username = "proyectos";
    $password = "Cr1santem0$$";

    try {
      $conn = new PDO("sqlsrv:server=$servername;database=$database;TrustServerCertificate=true", $username, $password);
      $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

      return $conn;
    } catch (PDOException $e) {
      throw new PDOException("Connection failed: " . $e->getMessage());
    }
  }
}
