intervention/zodiac
Zodiac Sign Calculator
Maintainers
Requires
- php: ^8.2
- illuminate/translation: ^11 || ^12 || ^13
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.0 || ^12.0
- slevomat/coding-standard: ~8.0
- squizlabs/php_codesniffer: ^4
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-06-11 14:14:47 UTC
README
π Latest Version
π Tests
π Monthly Downloads
π Support me on Ko-fi
Intervention Zodiac is a astrological calculator for PHP 8.2+ that resolves Western and Chinese zodiac signs from various data types.
- Fluent interface to calculate zodiac signs
- Support for western and chinese astrology
- Framework-agnostic
Installation
The installation works with Composer by running the following command.
composer require intervention/zodiac
Although the library is framework agnostic it comes with a service provider for the Laravel Framework. Which will be discovered automatically and registers the calculator into your installation.
Getting Started
Read the full documentation for this library.
Code Examples
Calculator
use Intervention\Zodiac\Calculator; use Intervention\Zodiac\Astrology; use DateTime; // create calculator with astrology $calculator = new Calculator(Astrology::WESTERN); // calculate various date formats $sign = $calculator->calculate('2001-01-01'); $sign = $calculator->calculate('first day of june 2014'); $sign = $calculator->calculate('2018-06-15 12:34:00'); $sign = $calculator->calculate(new DateTime('2001-01-01')); $sign = $calculator->calculate(228268800); $sign = $calculator->calculate('228268800'); // override the default astrology $sign = $calculator->calculate('2001-01-01', Astrology::CHINESE);
Sign
use Intervention\Zodiac\Sign; use Intervention\Zodiac\Chinese\Sign as ChineseSign; use Intervention\Zodiac\Western\Sign as WesternSign; use DateTime; // parse signs directly $sign = Sign::fromString('2000-01-01'); $sign = Sign::fromString('first day of june 2014'); $sign = Sign::fromDate(new DateTime('2001-01-01')); $sign = Sign::fromUnix(228268800); $sign = Sign::fromUnix('228268800'); // parse western signs directly $sign = WesternSign::fromString('2000-01-01'); // parse chinese signs directly $sign = ChineseSign::fromString('2000-01-01'); // sign methods $name = $sign->name(); // 'gemini' $html = $sign->html(); // 'βοΈ' $localized = $sign->localize('fr')->name(); // GΓ©meaux $compatibility = $sign->compatibility($sign); // .6
Authors
This library is developed and maintained by Oliver Vogel
Thanks to the community of contributors who have helped to improve this project.
License
Intervention Zodiac is licensed under the MIT License.
