Skip to content

palmtreephp/string

Repository files navigation

🌴 Palmtree String

License Build Packagist Version

Object-oriented string manipulation library

Requirements

  • PHP >= 8.1

Installation

Use composer to add the package to your dependencies:

composer require palmtree/string

Usage

use function Palmtree\String\s;

$str = s('foo bar baz');

$str->startsWith('foo'); // true
$str->endsWith('baz'); // true
$str->contains('bar'); // true

$str->replace('bar', 'qux'); // 'foo qux baz'

$str->after('bar'); // ' baz'
$str->afterLast('b'); // 'az'
$str->beforeFirst('b'); // 'foo '

$str->kebab(); // 'foo-bar-baz'
$str->camel(); // 'fooBarBaz'
$str->snake(); // 'foo_bar_baz'

Many other methods are provided. Read through the documented source code to see more.

License

Released under the MIT license

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages