PHPackages                             geoffreyrose/date-and-number-to-words - 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. geoffreyrose/date-and-number-to-words

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

geoffreyrose/date-and-number-to-words
=====================================

Converts PHP Dates, Carbon objects and numbers to words

v1.3.0(1y ago)3848MITPHPPHP ^8.0

Since Feb 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/geoffreyrose/date-and-number-to-words)[ Packagist](https://packagist.org/packages/geoffreyrose/date-and-number-to-words)[ GitHub Sponsors](https://github.com/geoffreyrose)[ RSS](/packages/geoffreyrose-date-and-number-to-words/feed)WikiDiscussions main Synced 1mo ago

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

[![Latest Stable Version](https://camo.githubusercontent.com/956e1bdea7dfa3bd9214c128bd541d6110d194cb8e5c806c7feb585c9f9fd17b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f67656f6666726579726f73652f646174652d616e642d6e756d6265722d746f2d776f7264733f7374796c653d666c61742d737175617265)](https://packagist.org/packages/geoffreyrose/date-and-number-to-words)[![Total Downloads](https://camo.githubusercontent.com/0882cd6efd55d5ab8ad78dc2c151de8554a0b776aa7edb1c0ac1f069422b123d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67656f6666726579726f73652f646174652d616e642d6e756d6265722d746f2d776f7264733f7374796c653d666c61742d737175617265)](https://packagist.org/packages/geoffreyrose/date-and-number-to-words/stats)[![GitHub Workflow Status](https://camo.githubusercontent.com/6ebdadf9ea70815415196a1a522bca26938f3b0a26ba7e86c9a64418109a8890/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f67656f6666726579726f73652f646174652d616e642d6e756d6265722d746f2d776f7264732f6d61696e2e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265)](https://github.com/geoffreyrose/date-and-number-to-words/actions?query=branch%3Amain)[![Codecov branch](https://camo.githubusercontent.com/3c610ffb4c3335f933e1419ec5125ac4363103438fe43f32a8cf2b17ab7f5f5a/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f67682f67656f6666726579726f73652f646174652d616e642d6e756d6265722d746f2d776f7264732f6d61696e3f7374796c653d666c61742d737175617265)](https://app.codecov.io/gh/geoffreyrose/date-and-number-to-words/branch/main)[![License](https://camo.githubusercontent.com/c75ed035fc2a98e5c71c64d726e8400a077501af26a2796708c6d06a2ad15508/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f67656f6666726579726f73652f646174652d616e642d6e756d6265722d746f2d776f7264733f7374796c653d666c61742d737175617265)](https://github.com/geoffreyrose/date-and-number-to-words/blob/main/License)

PHP: Date and Number To Standard Words or Ordinal Words + Laravel Facade
========================================================================

[](#php-date-and-number-to-standard-words-or-ordinal-words--laravel-facade)

An easy-to-use PHP package (and Laravel Facade) that turns dates and numbers into words or ordinal words.

Numbers and each part of the date can additionally be turned into ordinal words. (first, second, third)

### Requirements

[](#requirements)

- [Carbon](http://carbon.nesbot.com/)
- PHP 8.0+

### Usage

[](#usage)

#### Install

[](#install)

```
composer require geoffreyrose/date-and-number-to-words

```

### With Plain PHP

[](#with-plain-php)

```
use DateAndNumberToWords\DateAndNumberToWords;

...

$words = new DateAndNumberToWords();
$carbon = Carbon::create(2023, 4, 1);

$words->words($carbon, 'Do of M, Y');
```

### With Laravel Facade

[](#with-laravel-facade)

Laravel uses Package Auto-Discovery, which doesn't require you to manually add the ServiceProvider and Facade.

```
$words = DateAndNumberToWords::words(now(), 'Do of M, Y');
```

Methods
-------

[](#methods)

You can pass a Carbon object, DateTime object or an integer for most methods

**Note all examples below use Plain PHP (use DateAndNumberToWords\\DateAndNumberToWords) but can be swapped with Laravel Facade (DateAndNumberToWords)**

### Dates to Words

[](#dates-to-words)

```
public function words(Carbon|DateTime $date, string $format): string

$words = new DateAndNumberToWords();
$carbon = Carbon::create(2023, 4, 1);

$words->words($carbon, 'Do of M, Y');
// first of April, two thousand twenty-three
```

#### Formats

[](#formats)

```
Yo  :  Ordinal Year - year($year, true)
Y   :  Year - year($year)
Mo  :  Ordinal Month - month($month, true)
M   :  Month - month($month)
Do  :  Ordinal Day - day($day, true)
D   :  Day - day($day)
Ho  :  Ordinal Hour - hour($hour, true)
H   :  Hour - hour($hour)
Io  :  Ordinal Minute - minute($minute, true)
I   :  Minute - minute($minute)
So  :  Ordinal Second - second($second, true)
S   :  Second - second($second)

```

### Year to Words

[](#year-to-words)

```
public function year(int|Carbon|DateTime $year, bool $ordinal = false): string

$words = new DateAndNumberToWords();
$carbon = Carbon::create(2023, 4, 1);

$dateTime = new DateTime();
$dateTime->setDate(2023, 4, 1);

$date = new DateTime();

$words->year($carbon, true);
// two thousand twenty-third

$words->year($dateTime);
// two thousand twenty-three

$words->year(2023, true);
// two thousand twenty-third

$words->year(2023);
// two thousand twenty-three
```

### Month to Words

[](#month-to-words)

```
public function month(int|Carbon|DateTime $month, bool $ordinal = false): string

$words = new DateAndNumberToWords();

$words->month(4, true);
// fourth

$words->month(4);
// April
```

### Day to Words

[](#day-to-words)

```
public function day(int|Carbon|DateTime $day, bool $ordinal = false): string

$words = new DateAndNumberToWords();

$words->day(7, true);
// seventh

$words->day(7);
// seven
```

### Hour to Words

[](#hour-to-words)

```
public function hour(int|Carbon|DateTime $hour, bool $ordinal = false): string

$words = new DateAndNumberToWords();

$words->hour(7, true);
// seventh

$words->hour(7);
// seven
```

### Minute to Words

[](#minute-to-words)

```
public function minute(int|Carbon|DateTime $minute, bool $ordinal = false): string

$words = new DateAndNumberToWords();

$words->minute(7, true);
// seventh

$words->minute(7);
// seven
```

### Second to Words

[](#second-to-words)

```
public function second(int|Carbon|DateTime $second, bool $ordinal = false): string

$words = new DateAndNumberToWords();

$words->second(7, true);
// seventh

$words->second(7);
// seven
```

### Number to Words

[](#number-to-words)

Must be between 999999999999999999 and -999999999999999999

Only `int` will return an ordinal word. If `$ordinal` is true but `$number` is `float` a non-ordinal word will be returned.

```
public function number(int|float $number, bool $ordinal = false): string

$words = new DateAndNumberToWords();

$words->number(7, true);
// seventh

$words->number(7);
// seven

$words->number(24.68);
// twenty-four point six eight

$words->number(24.68, true);
// twenty-four point six eight

$words->number(999999999999999999)
// nine hundred ninety-nine quadrillion nine hundred ninety-nine trillion nine hundred ninety-nine billion nine hundred ninety-nine million nine hundred ninety-nine thousand nine hundred ninety-nine
```

### Set Language

[](#set-language)

The default language is `en`

Every method other than `month` supports every language PHP does. PHP's native `NumberFormatter` is being used to translate numbers to words.

For months, translations are handled by Carbon, which has translations for 270+ locales.

```
public function setLanguage(string $language): void

$words = new DateAndNumberToWords();

$words->setLanguage('en');
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Total

4

Last Release

542d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c0ea002166251eee24c3b893c709b5b126b4c83df3d61e4b026eb552b80e31fc?d=identicon)[geoffreyrose](/maintainers/geoffreyrose)

---

Top Contributors

[![geoffreyrose](https://avatars.githubusercontent.com/u/3210702?v=4)](https://github.com/geoffreyrose "geoffreyrose (30 commits)")

---

Tags

date-to-wordslaravelnumber-to-wordsordinal-wordsphpcarbonPHP DatesPHP Dates To WordsPHP Numbers To WordsOrdinal Numbers WordsOrdinal Date Words

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/geoffreyrose-date-and-number-to-words/health.svg)

```
[![Health](https://phpackages.com/badges/geoffreyrose-date-and-number-to-words/health.svg)](https://phpackages.com/packages/geoffreyrose-date-and-number-to-words)
```

###  Alternatives

[kylekatarnls/laravel-carbon-2

Carbon 2 adapter for Laravel

631.2M1](/packages/kylekatarnls-laravel-carbon-2)[geoffreyrose/us-holidays

US Holidays Wrapper for the Carbon DateTime Library.

62717.0k2](/packages/geoffreyrose-us-holidays)[rovangju/carbon-nbd

Carbon DateTime extension to calculate the "next business day"

2125.4k](/packages/rovangju-carbon-nbd)

PHPackages © 2026

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