Zodiac
Working with Zodiac Objects
4k Downloads / Month
Open Source MIT License
4k Downloads / Month
Open Source MIT License
Discover how to use the zodiac objects returned by the Intervention Image Zodiac Calculator. Generate localized contents and use a compatibility calculator based on astrological theory.
public Zodiac::name(): string
Return the name of the current zodiac. This is more a identification key than a textual title. It's possible to cast the zodiac object to a string type to get the same result.
use Intervention\Zodiac\Calculator;
// create from iso date
$zodiac = Calculator::make('1977-06-17');
$name = $zodiac->name(); // "gemini"
$name = (string) $zodiac; // "gemini"
public Zodiac::localized(?string $locale = null): string
Return the localized title of the current zodiac in the given locale. The locale parameter is optional, by default the english language is returned.
use Intervention\Zodiac\Calculator;
// create from iso date
$zodiac = Calculator::make('1977-06-17');
$name = $zodiac->localized('fr'); // GĂ©meaux
public Zodiac::html(): string
Returns the HTML UTF-8 symbol code representing an icon of the current zodiac sign.
use Intervention\Zodiac\Calculator;
// create from iso date
$zodiac = Calculator::make('1977-06-17');
$name = $zodiac->html(); // ♊
public Zodiac::compatibility(ZodiacInterface $zodiac): float
This method calculates how a person with the current star sign matches another person with the given sign according to astrological theory.
The factor is returned as a float value of 0-1
, with a higher value
representing more compatibility.
This value is completely made up, so don't plan your life decisions around it.
use Intervention\Zodiac\Calculator;
$gemini = Calculator::make('1997-06-17'); // Intervention\Zodiac\Zodiacs\Gemini
$virgo = Calculator::make('2000-09-10'); // Intervention\Zodiac\Zodiacs\Virgo
$factor = $gemini->compatibility($virgo);
Edit