lllist/lllist-php

Humanized list and shit, cuz' we are human afterall

1.0.3 2019-12-03 14:30 UTC

This package is auto-updated.

Last update: 2025-03-29 00:37:58 UTC


README

Hate build conditional lists, phrases, texts? Me too. This library is made to avoid code boilerplate when building lists, and also avoid things like: Josecleiton likes: apple, bananas, grapes or Josecleiton likes: apple, grapes and also do null, you could simply:

lllist(', ', ' and ')
    ->items(['apple', 'bananas', 'grapes'])

Which will output apple, bananas and grapes

or

lllist(', ', ' and ')
    ->items(['apple', 'bananas', 'grapes'])
    ->sep(' and also ')
    ->append(null)

Which will output apple, bananas and grapes too, because lllist ignores empty values and also trim separators.

If you give lllist an empty list it will return null, because it's the right thing to do™.

Example:

lllist(', ', ' and ')
    ->items([])
    ->sep(' and also ')
    ->append(null)

Will output null 👍.

Documentation will be released.

Made with undefined by Wesley Schleumer