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.4.0(2mo ago)31.2kMITPHPPHP ^8.1CI passing

Since Feb 2Pushed 1mo 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 3d ago

READMEChangelog (5)Dependencies (8)Versions (8)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)[![Test Status](https://camo.githubusercontent.com/eb74852aa5afdd0066d62d94aeeb4fbfc0d526ce15f816b8f674ba13099cfb88/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f67656f6666726579726f73652f646174652d616e642d6e756d6265722d746f2d776f7264732f6d61696e2e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265266c6162656c3d7465737473)](https://github.com/geoffreyrose/date-and-number-to-words/actions?query=branch%3Amain)[![Code Coverage](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.1+

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

// You can escape the format string as well
$words->words($carbon, 'Do of M, \Y');
// first of April, Y
```

#### 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  :  (24 Hour) Ordinal Hour - hour($hour, true)
H   :  (24 Hour) Hour - hour($hour)
ho  :  (12 Hour) Ordinal Hour - hour($hour, true, false)
h   :  (12 Hour) Hour - hour($hour, twentyFour: false)
Io  :  Ordinal Minute - minute($minute, true)
I   :  Minute - minute($minute)
So  :  Ordinal Second - second($second, true)
S   :  Second - second($second)
A   :  AM / PM

```

### 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, bool $twentyFour = true): string

$words = new DateAndNumberToWords();

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

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

$date = Carbon::now()->setHour(13);
$words->hour($date, twentyFour: false); // one
$words->hour($date); // thirteen
```

### 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');
```

### Testing

[](#testing)

```
# Run tests
./vendor/bin/phpunit

herd coverage ./vendor/bin/phpunit
```

### Linting

[](#linting)

```
./vendor/bin/pint
```

### Static Analysis

[](#static-analysis)

```
./vendor/bin/phpstan analyse src --memory-limit 2G
```

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance89

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Total

5

Last Release

60d ago

PHP version history (2 changes)v1.0.0PHP ^8.0

v1.4.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3210702?v=4)[Geoffrey Rose](/maintainers/geoffreyrose)[@geoffreyrose](https://github.com/geoffreyrose)

---

Top Contributors

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

---

Tags

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

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

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

[illuminate/support

The Illuminate Support package.

630113.0M41.5k](/packages/illuminate-support)[craftcms/feed-me

Import content from XML, RSS, CSV or JSON feeds into entries, categories, Craft Commerce products, and more.

293952.6k33](/packages/craftcms-feed-me)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

54681.3k19](/packages/solspace-craft-freeform)[pimcore/data-importer

Adds a comprehensive import functionality to Pimcore Datahub

46855.5k5](/packages/pimcore-data-importer)[japanese-date/japanese-date

日本の暦、祝日を取り扱うライブラリ

1610.0k](/packages/japanese-date-japanese-date)[wilianx7/php-recurring

PHP library for generating recurring dates, schedules, and repeated task recurrences.

1050.7k](/packages/wilianx7-php-recurring)

PHPackages © 2026

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