Create a contact

$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => 'https://api.hubapi.com/crm/v3/objects/contacts',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => json_encode($data),
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'Authorization: Bearer ' . $_ENV["HS_TOKEN"],
    ]
]);
$response = curl_exec($curl);
$response = json_decode($response);
curl_close($curl);

Create a company

$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => 'https://api.hubapi.com/crm/v3/objects/companies',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => json_encode($data),
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'Authorization: Bearer ' . $_ENV["HS_TOKEN"],
    ]
]);
$response = curl_exec($curl);
$response = json_decode($response);
curl_close($curl);

Update a company

$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => 'https://api.hubapi.com/crm/v3/objects/companies/' . $id,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'PATCH',
    CURLOPT_POSTFIELDS => json_encode($data),
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'Authorization: Bearer ' . $_ENV["HS_TOKEN"],
    ]
]);
$response = curl_exec($curl);
$response = json_decode($response);
curl_close($curl);

Delete a company

$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => 'https://api.hubapi.com/crm/v3/objects/companies/' . $id,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'Authorization: Bearer ' . $_ENV["HS_TOKEN"],
    ]
]);
$response = curl_exec($curl);
$response = json_decode($response);
curl_close($curl);

Create a deal

$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => 'https://api.hubapi.com/crm/v3/objects/deals',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => json_encode($data),
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'Authorization: Bearer ' . $_ENV["HS_TOKEN"],
    ]
]);
$response = curl_exec($curl);
$response = json_decode($response);
curl_close($curl);

Create a ticket

$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => 'https://api.hubapi.com/crm/v3/objects/tickets',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => json_encode($data),
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'Authorization: Bearer ' . $_ENV["HS_TOKEN"],
    ]
]);
$response = curl_exec($curl);
$response = json_decode($response);
curl_close($curl);

composer require larapack/dd

dd($variable);

composer require vlucas/phpdotenv

Dotenv\Dotenv::createImmutable(__DIR__ . "/../")->load();

composer require catfan/medoo

$database = new Medoo([
    'type' => 'mysql',
    'charset' => 'utf8mb4',
    'collation' => 'utf8mb4_general_ci',
    'host' => $_ENV["DB_HOST"],
    'database' => $_ENV["DB_NAME"],
    'username' => $_ENV["DB_USERNAME"],
    'password' => $_ENV["DB_PASSWORD"]
]);

composer require ramsey/uuid

$uuid = Uuid::uuid4()->toString();

composer require phpmailer/phpmailer

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

$mail = new PHPMailer();
$mail->isSMTP();
$mail->isHTML(true);
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
$mail->SMTPAuth   = true;

$mail->Host     = $_ENV["EMAIL_HOST"];
$mail->Username = $_ENV["EMAIL_USERNAME"];
$mail->Password = $_ENV["EMAIL_PASSWORD"];
$mail->Port     = $_ENV["EMAIL_PORT"];

$mail->setFrom($_ENV["EMAIL_FROM_MAIL"], $_ENV["EMAIL_FROM_NAME"]);
$mail->addAddress("joe@example.net");

$mail->Subject = "Here is the subject";
$mail->Body    = "This is the message";
$mail->addAttachment("/tmp/image.jpg");

$mail->send();

composer require phpoffice/phpspreadsheet

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;

$spreadsheet = new Spreadsheet();
$activeWorksheet = $spreadsheet->getActiveSheet();
$activeWorksheet->setCellValue('A1', 'Hello World !');

$writer = new Xlsx($spreadsheet);
$writer->save('hello world.xlsx');