PHP code example of inovanti-bank / inovanti-holidays

1. Go to this page and download the library: Download inovanti-bank/inovanti-holidays library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

inovanti-bank / inovanti-holidays example snippets


use Inovanti\Holidays\Models\Holiday;

$holidays = Holiday::all();

use InovantiBank\Holidays\Services\HolidaysService;

$service = app(HolidaysService::class);

$holiday = $service->create([
    'name' => 'Dia da Independência',
    'date' => '2025-09-07',
    'type' => 'fix',
    'state' => null,
    'optional' => false,
    'scope' => 'state',
]);
// Se o feriado já estiver cadastrado, será lançada uma exceção com a mensagem:
// Já existe um feriado com esses parâmetros.

$service->create([
    'name' => 'Feriado Anual',
    'date' => '2025-06-15',
    'type' => 'fix',
    'scope' => 'state',
    'optional' => false,
    'state' => 'SP',
], true); 
// Criará o mesmo feriado para todos os anos da base
// Se um feriado para aquele ano já existir, ele será ignorado.

return Holiday::where('date', '2025-12-25')->exists();

use Carbon\Carbon;
use InovantiBank\Holidays\Helpers\DateHelper;
// Consulte mais métodos de apoio na classe DateHelper

$today = Carbon::today();
return $helper->getNextBusinessDay($today);
bash
php artisan migrate
bash
php artisan holidays:save
bash
php artisan holidays:save --yearFrom=2025 --years=5
bash
php artisan holidays:save --truncate