Skip to content

Latest commit

 

History

History
48 lines (30 loc) · 1.15 KB

README.md

File metadata and controls

48 lines (30 loc) · 1.15 KB

🌴 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