Skip to content

v0.1.0

Latest

Choose a tag to compare

@vlahanas vlahanas released this 07 Aug 22:17

πŸš€ Initial release β€” v0.1.0

php-string-formatter is a simple and configurable string formatting pipeline for PHP.

It lets you apply formatting rules via a compact DSL, for example:

padLeft:10:0;replace:_:space;padAfterFirst:11:0

βœ… Supported formatters

  • padLeft:length:char β€” Pads the string on the left to a given length using a character.
  • padRight:length:char β€” Pads the string on the right to a given length using a character.
  • replace:search:replace β€” Replaces all occurrences of search with replace.
  • remove:target β€” Removes all occurrences of target.
  • padAfterFirst:length:char β€” Pads the portion after the first character to the given length using a character.

πŸ”€ Special keyword

  • Use "space" to represent a space character (e.g. replace:_:space β†’ replaces _ with a space)

See the README for full usage and examples.