PHPackages                             grosv/sundial - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. grosv/sundial

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

grosv/sundial
=============

An attempt at natural language date / time parsing in PHP

0.3.1(5y ago)617[2 issues](https://github.com/grosv/sundial/issues)MITPHPPHP ^7.4CI failing

Since Jul 3Pushed 5y ago1 watchersCompare

[ Source](https://github.com/grosv/sundial)[ Packagist](https://packagist.org/packages/grosv/sundial)[ RSS](/packages/grosv-sundial/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (8)Versions (5)Used By (0)

Sundial
=======

[](#sundial)

Natural Language Date / Time String Parsing for PHP 7.4+

 [![](https://raw.githubusercontent.com/grosv/sundial/main/docs/sundial.jpg)](https://raw.githubusercontent.com/grosv/sundial/main/docs/sundial.jpg)

 [![GitHub Workflow Status (main)](https://camo.githubusercontent.com/e8e463541fcc486644852f9c671b3e872677bca23dcb63c85de21eece67e437c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f67726f73762f73756e6469616c2f54657374732f6d61696e)](https://github.com/grosv/sundial/actions) [![Total Downloads](https://camo.githubusercontent.com/0c4a9a2bfc0b83fa03a0f98f10824cd441a564467e4bb3be5af6473ab094aed3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67726f73762f73756e6469616c)](https://packagist.org/packages/grosv/sundial) [![Latest Version](https://camo.githubusercontent.com/a6573839806f817a2cd411b3f5f6b10e42b2091849872971a36077816fc3edcd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f67726f73762f73756e6469616c)](https://packagist.org/packages/grosv/sundial) [![License](https://camo.githubusercontent.com/7719a17f8bda7eca4a57eb171a56aa2678e23ff46bcedf37cefef5548875f77f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f67726f73762f73756e6469616c)](https://packagist.org/packages/grosv/sundial)

### Installation

[](#installation)

Warning: This package is not yet stable. There might be breaking changes until the 1.0 release.

```
composer require grosv/sundial
```

### Usage

[](#usage)

```
$parser = new Grosv\Sundial\Parser();

$parser->parse('9th of August 2024 at 11:30 am')->toTimestamp(); // Get a unix timestamp

$parser->parse('December the 25th of this year')->toFormat('m/d/Y'); // 12/25/2020

// You can set a valid date range with setBetween($start, $end) where start and end are UNIX timestamps.
$parser->setBetween(time(), strtotime('+1 year'))->parse('tomorrow')->toFormat('m/d/Y'); // Works as expected
$parser->setBetween(time(), strtotime('+1 year'))->parse('August 9, 1992')->toFormat('m/d/Y'); // Exception

// By default we use English but this can be overridden using the ISO 639-2 Code of the language if we have it.
$parser->setLanguage('esp')->parse('23 Mayo, 20204')->toFormat('m/d/Y'); // 05/23/2024
```

### Help Wanted

[](#help-wanted)

This is very much a minimum viable package and needs a great deal of TLC. Contributions are welcome from anyone willing to jump in and work on the code, add more tests, knock out an issue, do a translation o a new language, or just build out the documentation.

### What Remains

[](#what-remains)

Date and time parsing is in pretty good shape so as long as what's typed into the box contains an actual date and time it's usually parsed correctly. I'm sure we'll find cases where it's not and get those handled with little trouble.

The hard part starts now. Things like "Next Tuesday at 4 pm" and even better "Next Tuesday at 4 in the afternoon" and the gold standard would be "Christmas Eve at ten to midnight".

### Shout Out

[](#shout-out)

This is the first package I've built using [Nuno Maduro's Skeleton PHP](https://github.com/nunomaduro/skeleton-php). It was a great experience. I'm definitely going to use it again and I wouldn't hesitate to recommend it to anyone looking for a really solid PHP package boilerplate to kickstart their project.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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 ~0 days

Total

4

Last Release

2188d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1053395?v=4)[Ed Grosvenor](/maintainers/edgrosvenor)[@edgrosvenor](https://github.com/edgrosvenor)

---

Top Contributors

[![edgrosvenor](https://avatars.githubusercontent.com/u/1053395?v=4)](https://github.com/edgrosvenor "edgrosvenor (18 commits)")

---

Tags

phptimedatenatural-language

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/grosv-sundial/health.svg)

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

###  Alternatives

[punic/punic

PHP-Unicode CLDR

1573.0M31](/packages/punic-punic)[wapmorgan/time-parser

A parser for date &amp; time written in natural language

97131.6k](/packages/wapmorgan-time-parser)[kartik-v/php-date-formatter

A Javascript datetime formatting and manipulation library using PHP date-time formats.

461.6M3](/packages/kartik-v-php-date-formatter)[dater/dater

Compact PHP library for working with date/time in different formats &amp; timezones.

14484.2k](/packages/dater-dater)[zjkal/time-helper

一个简单快捷的PHP日期时间助手类库。 a smart PHP datetime helper library.

21030.2k2](/packages/zjkal-time-helper)[ernysans/laraworld

Countries, Languages and Time Zones Package for Laravel 5.\*

1757.0k](/packages/ernysans-laraworld)

PHPackages © 2026

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