Carbon Zodiac
Chinese zodiac helpers for the Carbon date library. Given a Gregorian date, the package resolves the Chinese New Year threshold for that calendar year, then derives the lunar year, sign (12 animals), and element (5 elements).
Documentation
Requirements
- PHP 8.3+
nesbot/carbon2+illuminate/support10+ (Laravel service provider auto-discovery; also used forCollectionhelpers)
Quick start
composer require bradietilley/carbon-zodiac
use BradieTilley\Zodiac\Zodiac;
use Carbon\Carbon;
Zodiac::boot();
$date = Carbon::parse('2024-02-10');
$date->zodiacYear()->year; // 2024
$date->zodiacSign(); // Sign::DRAGON
$date->zodiacElement(); // Element::WOOD
See Installation and Usage for the full walkthrough.