Zodiac Sign Calculator

Maintainers

πŸ‘ olivervogel

Package info

github.com/Intervention/zodiac

Homepage

pkg:composer/intervention/zodiac

Statistics

Installs: 201 152

Dependents: 0

Suggesters: 0

Stars: 57

Open Issues: 1

7.0.3 2026-05-31 09:14 UTC

Requires

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 930d6a9eb4328d96d477bcac8c8fa32951a0a2bb

zodiachoroscopebirthdaysun signstar signastrology


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.