PHPackages                             ottosmops/antondate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ottosmops/antondate

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ottosmops/antondate
===================

Date which are used for Anton

v0.0.7(4mo ago)0205MITPHPCI passing

Since Dec 15Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/ottosmops/antondate)[ Packagist](https://packagist.org/packages/ottosmops/antondate)[ Docs](https://github.com/ottosmops/antondate)[ RSS](/packages/ottosmops-antondate/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (4)Versions (6)Used By (0)

Antondate
=========

[](#antondate)

[![Latest Version on Packagist](https://camo.githubusercontent.com/52ee76553335f01d95871209da910fd3202c4247831cbaeae5d950e72d21ea76/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f74746f736d6f70732f616e746f6e646174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ottosmops/antondate)[![Total Downloads](https://camo.githubusercontent.com/542f1a539aa66864c10f1d122ddcb52743533337fb68a28430679945587feb7b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f74746f736d6f70732f616e746f6e646174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ottosmops/antondate)[![Tests](https://github.com/ottosmops/antondate/actions/workflows/run-tests.yml/badge.svg)](https://github.com/ottosmops/antondate/actions/workflows/run-tests.yml)

Using Dates in Anton ([anton.ch](https://www.anton.ch)).

Installation
------------

[](#installation)

Via Composer

```
$ composer require ottosmops/antondate
```

Add `date_start`, `date_start_ca`, `date_end`, `date_end_ca` to the database table.

Add the casts to the model:

```
protected $casts = [
    'anton_date_interval' => AntonDateIntervalCast::class,
    'anton_date_start' => AntonDateStartCast::class,
    'anton_date_end' => AntonDateEndCast::class,
];
```

Usage
-----

[](#usage)

The package covers two ValueObjects: AntonDate, AntonDateInterval (consisting of two AntonDates).

### Create an AntonDate

[](#create-an-antondate)

```
AntonDate::createFromString('1995-03-01', 1) : AntonDate
// ca. 1995-03-01

AntonDate::guessFromString('4. Mai 1905') : AntonDate
// 1905-05-04

AntonDate::compose(1973, 12, 3, 1) : AntonDate
// ca. 1973-12-03

AntonDate::today() : AntonDate
```

### Validate

[](#validate)

```
AntonDate::isValidString('1997-13-01'); // false
AntonDate::isValidString('ca. 1997-11-01'); // true
```

### Get

[](#get)

```
$antondate->toString();
$antondate->toArray();
$antondate->formatted();
$antondate->toMysqlDate();
$antondate->getCa();
$antondate->getYear();
$antondate->getMonth();
$antondate->getDay();
```

### Compare

[](#compare)

```
$antondate->isEqualTo($antondate2, true); // compare with ca
$antondate->isEqualTo($antondate2); // compare without ca
$antondate->isGreaterThan($antondate2);
$antondate->isLessThan($antondate2);

```

### Rule

[](#rule)

There is also a rule which you can use for validation:

```
use Ottosmops\Antondate\Rules\AntonDateRule;

// Strict mode (default) - uses AntonDate::createFromString()
new AntonDateRule()
new AntonDateRule(strict: true)

// Non-strict mode - uses AntonDate::guessFromString()
new AntonDateRule(strict: false)
```

License
-------

[](#license)

MIT. Please see the [license file](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance76

Regular maintenance activity

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~371 days

Total

5

Last Release

132d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/76f31e7e6772db47a91388ed82840fae1fa57185bb82a64924bb3839697222c2?d=identicon)[ottosmops](/maintainers/ottosmops)

---

Top Contributors

[![ottosmops](https://avatars.githubusercontent.com/u/4144389?v=4)](https://github.com/ottosmops "ottosmops (34 commits)")

---

Tags

laraveldateAntondate

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

### Embed Badge

![Health badge](/badges/ottosmops-antondate/health.svg)

```
[![Health](https://phpackages.com/badges/ottosmops-antondate/health.svg)](https://phpackages.com/packages/ottosmops-antondate)
```

###  Alternatives

[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4205.3M84](/packages/livewire-volt)[forxer/laravel-gravatar

A library providing easy gravatar integration in a Laravel project.

4235.6k](/packages/forxer-laravel-gravatar)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)[maherelgamil/arabicdatetime

Easy and useful tool to generate arabic or hijri date with multi-language support for laravel

414.5k](/packages/maherelgamil-arabicdatetime)[aloko/nova-persian-datepicker

Persian Datepicker for Laravel Nova.

203.5k](/packages/aloko-nova-persian-datepicker)[p3ym4n/jdate

Date converter from Jalali to Georgian and vice versa. It has Carbon instance inside and it's Laravel friendly.

101.8k2](/packages/p3ym4n-jdate)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
