---
application: "Intervention Zodiac"
version: "Version 5"
status: "stable"
---

# Zodiac

## Working with Zodiac Objects

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.


### Zodiac Name

> 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.

```php
use Intervention\Zodiac\Calculator;

// create from iso date
$zodiac = Calculator::make('1977-06-17');
$name = $zodiac->name(); // "gemini"
$name = (string) $zodiac; // "gemini"
```

### Localized Title

> 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.

```php
use Intervention\Zodiac\Calculator;

// create from iso date
$zodiac = Calculator::make('1977-06-17');
$name = $zodiac->localized('fr'); // Gémeaux
```

### HTML Representation

> public Zodiac::html(): string

Returns the [HTML UTF-8 symbol
code](https://www.w3schools.com/charsets/ref_utf_symbols.asp) representing an
icon of the current zodiac sign.

```php
use Intervention\Zodiac\Calculator;

// create from iso date
$zodiac = Calculator::make('1977-06-17');
$name = $zodiac->html(); // &#9802;
```

### Zodiac Sign Compatibility

> 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.


```php
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);
```

---

## Become a Sponsor

### Intervention Zodiac needs your help to keep the project going

Intervention Zodiac is non-commercial, open source licensed and completely free to use. The considerable
effort required to maintain and develop the software is only possible with the financial support
of sponsors. There are two ways in which you can support this project.

- Support via [GitHub Sponsors](https://github.com/sponsors/Intervention)
- Support via [Ko-Fi](https://ko-fi.com/interventionphp)