2017 © Pedro Peláez
 

library stringy

A PHP Library that provides a consistent api for object oriented manipulation of strings.

image

mpclarkson/stringy

A PHP Library that provides a consistent api for object oriented manipulation of strings.

  • Friday, July 22, 2016
  • by hilenium
  • Repository
  • 2 Watchers
  • 6 Stars
  • 2,130 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Stringy - Object Oriented Manipulation of Strings in PHP!

Scrutinizer Code Quality Build Status, (*1)

Overview

Are you stick to death of PHP's inconsistencies in terms on manipulating strings? Well, look no further!, (*2)

Rather than constantly having to write obtuse code like this to check if a string contains a substring:, (*3)

``` php strpos($mystring, $substring) !== false ? true : false;, (*4)


You can now do this (and many other things), sensibly! ``` php $string = new String($myString); $bool = $string->contains($substring);

Yay! :), (*5)

Usage

After applying any methods, the underlying text/string can be accessed as follows:, (*6)

$stringy = new Stringy("mystring");
$stringy->append("is fun", " ");

echo $stringy->string();
//"mystring is fun";

Methods

Method Parameters Returns
string nil string
truncate $chars = 50, $appendWith = "..." $this
length nil int
contains $substring bool
startsWith $substring bool
endsWith $substring bool
append $string $this
reverse nil $this
uppercase nil $this
uppercaseFirst nil $this
lowercase nil $this
lowercaseFirst nil $this
titleCase nil $this
sentenceCase nil $this
toArray $delimiter = null array
apply callback $this

Checkout the tests for examples of each method., (*7)

Requirements

  • PHP 5.4+

Composer

Use Composer by adding the following lines in your composer.json:, (*8)


"require": { "mpclarkson/stringy": "dev-master" },

Todos

  • More methods
  • Contributions welcome

Credits

This has been inspired by the beautify string manipulation in Apple's Swift language., (*9)

Thanks goes to Paper Planes Digital Marketing in Brisbane., (*10)

The Versions

22/07 2016

dev-master

9999999-dev https://github.com/mpclarkson/icon-scraper

A PHP Library that provides a consistent api for object oriented manipulation of strings.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

The Development Requires

text manipulation string object oriented

10/11 2015

dev-scrutinizer-patch-1

dev-scrutinizer-patch-1 https://github.com/mpclarkson/icon-scraper

A PHP Library that provides a consistent api for object oriented manipulation of strings.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

The Development Requires

text manipulation string object oriented

09/11 2015

v1.0.1

1.0.1.0 https://github.com/mpclarkson/icon-scraper

A PHP Library that provides a consistent api for object oriented manipulation of strings.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

The Development Requires

text manipulation string object oriented

09/11 2015

1.0.0

1.0.0.0 https://github.com/mpclarkson/icon-scraper

A PHP Library that provides a consistent api for object oriented manipulation of strings.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

The Development Requires

icon scraper favicon finder apple-touch-icon