oranfry / english-lists
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/oranfry/english-lists
This package is auto-updated.
Last update: 2025-10-15 05:40:04 UTC
README
This library enables you to render a PHP array as an English-language list.
For example, the array ['A', 'B', 'C', 'D'] becomes string 'A, B, C, and D'.
You can designate an alternative to the "and" (such as "or").
You can also turn off the oxford comma.
Installation
composer require oranfry/english-lists
Usage
use EnglishLists\EnglishLists; $myArray = ['Blood', 'Toil', 'Tears', 'Sweat']; echo EnglishLists::render( $myArray, // the array to render 'or', // the final separator (default: and) false, // don't use an oxford comma (default: use oxford comma) ); // Blood, Toil, Tears or Sweat echo EnglishLists::render(['One']); // One echo EnglishLists::render(['One', 'Two']); // One and Two echo EnglishLists::render(['One', 'Two', 'Three']); // One, Two, and Three