1. Go to this page and download the library: Download popy/republican-calendar 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/ */
popy / republican-calendar example snippets
use Popy\RepublicanCalendar\Factory\CalendarFactory;
$factory = new CalendarFactory();
$calendar = $factory->buildRepublican();
echo $calendar->format(new DateTime(), 'Y-m-d') . "\n";
echo $calendar->format(new DateTime(), 'l jS F y, X|F, X, y H:i:s') . "\n";
use Popy\RepublicanCalendar\Factory\CalendarFactory;
$factory = new CalendarFactory();
$calendar = $factory->buildRepublican([
// Lets use a better leap year calculator
'leap' => 'futuristic',
// Will wrap it with RommeWithFixedLeapDay
'leap_wrapper' => 'fixed',
]);
echo $calendar->format(new DateTime(), 'Y-m-d');
use Popy\RepublicanCalendar\Factory\CalendarFactory;
$factory = new CalendarFactory();
$calendar = $factory->buildRepublican();
$format = 'l jS F Y, X|F, X, Y';
// WIll output "Primidi 1e Vendémiaire 0001, Raisin"
echo $calendar->format(new DateTime('1792-09-22 00:00:00'), $format) . "\n";
// Will output "Sans-culottides, jour de la révolution, 0019"
echo $calendar->format(new DateTime('1811-09-23 00:00:00'), $format) . "\n";
// Will output 1792-09-22
echo $calendar->parse('Primidi 1e Vendémiaire 0001, Raisin', $format)
->format('Y-m-d') . "\n"
;
// Will output 1811-09-23
echo $calendar->parse('Sans-culottides, jour de la révolution, 0019', $format)
->format('Y-m-d') . "\n"
;