wikimedia/wrappedstring

Automatically compact sequentially-outputted strings that share a common prefix / suffix pair.

Package info

github.com/wikimedia/WrappedString

Homepage

pkg:composer/wikimedia/wrappedstring

Statistics

Installs: 879 516

Dependents: 1

Suggesters: 0

Stars: 4

v4.1.0 2025-11-04 21:35 UTC

Requires

  • php: >=8.1

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT bf0622c326cd46b373a385ba0bd1ff8d459a7579

  • Timo Tijhof <krinklemail.woop@gmail.com>

This package is auto-updated.

Last update: 2026-06-06 00:32:52 UTC


README

WrappedString is a small PHP library for compacting redundant string-wrapping code in text output. The most common use-case is to eliminate redundant runs of HTML open/close tags and JavaScript boilerplate.

Here is how you use it:

use Wikimedia\WrappedString;

$buffer = [
	new WrappedString( '[foo]', '[', ']' ),
	new WrappedString( '[bar]', '[', ']' ),
];
$output = WrappedString::join( "\n", $buffer );
// Result: '[foobar]'

License

The project is licensed under the MIT license.