<?php

namespace App\Helpers;

class PdfHelper
{

public static function load(): bool
{

if(
class_exists(
'FPDF'
)
){
return true;
}

$paths=[

BASE_PATH
.
'/vendor/fpdf/fpdf.php',

BASE_PATH
.
'/vendor/setasign/fpdf/fpdf.php',

'/usr/share/php/fpdf/fpdf.php',

'/usr/share/php/fpdf.php'

];

foreach(
$paths
as $path
){

if(
file_exists(
$path
)
){

require_once
$path;

if(
class_exists(
'FPDF'
)
){
return true;
}

}

}

/*
silent mode
*/

return false;

}

public static function available(): bool
{

return
self::load();

}

}
