bitandblack/sentence-construction

Creates nice sentences out of arrays

Package info

bitbucket.org/wirbelwild/sentence-construction

Homepage

pkg:composer/bitandblack/sentence-construction

Fund package maintenance!

Buymeacoffee

Statistics

Installs: 152 362

Dependents: 3

Suggesters: 0

2.2.0 2025-04-14 06:21 UTC

Requires

  • php: >=8.0

Suggests

Provides

None

Conflicts

None

Replaces

None

MIT 1c1ca8fa2bef4597c5f486bf3d736f3ebd229f17

languagegrammarwordssentence

This package is auto-updated.

Last update: 2026-06-23 20:24:10 UTC


README

👁 PHP from Packagist
👁 Latest Stable Version
👁 Total Downloads
👁 License

Sentence construction

Creates nice sentences out of arrays.

Installation

This library is made for the use with Composer. Add it to your project by running $ composer require bitandblack/sentence-construction.

Usage

Create a sentence like that:

<?php

use BitAndBlack\SentenceConstruction;

$fruits = [
 'Apples', 
 'Bananas', 
 'Pears'
];

$sentence = new SentenceConstruction(
 glue: ', ', 
 glueLast: ' and ', 
 pieces: $fruits,
);

var_dump('I like ' . $sentence);

This will dump I like Apples, Bananas and Pears.

The SentenceConstruction class provides the method getSentence but is also stringable by itself, so you can simply echo it.

Help

If you have any questions, feel free to contact us under hello@bitandblack.com.

Further information about Bit&Black can be found under www.bitandblack.com.