PHP code example of lina / hijri-date

1. Go to this page and download the library: Download lina/hijri-date 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/ */

    

lina / hijri-date example snippets


// config/hijri.php

return [
    'adjustment' => 2, // Example: +2 for Saudi Arabia (Umm al-Qura)
];

use Illuminate\Support\Carbon;

// Automatically converts today's date
echo now()->toHijri(); 

// Converts a specific date
echo Carbon::parse('2024-01-01')->toHijri();

use Lina\HijriDate\Facades\Hijri;

// Converts today's date
echo Hijri::convertToHijri();

// Converts a specific date
echo Hijri::convertToHijri('2024-01-01');
bash
php artisan vendor:publish --tag=hijri-config