bitandblack / sentence-construction
Creates nice sentences out of arrays
Fund package maintenance!
Buymeacoffee
Requires
- php: >=8.0
Requires (Dev)
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^10.0
- rector/rector: ^2.0
- symplify/easy-coding-standard: ^12.0
Suggests
- bitandblack/german-words: A huge list of german words and their grammar rules
README
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.