2017 © Pedro Peláez
 

project simple-string

A small library for object-oriented string manipulation with PHP.

image

klaussilveira/simple-string

A small library for object-oriented string manipulation with PHP.

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 3 Open issues
  • 2 Versions
  • 22 % Grown

The README.md

SimpleString

Build Status, (*1)

A small library for string manipulation with PHP. SimpleString uses method overloading to create an object-oriented interface for the built-in string functions in PHP. It implements a fluent interface, improving how we manipulate strings, and extends functionality by providing common implementations. It also aims to eliminate the problems of unorganized function names., (*2)

SimpleString also uses overloading to create an object-oriented interface for built-in string functions. Functions starting with str or str_ can just be used with their actual name, not prefix. So: strtolower = tolower, str_replace = replace. Functions whose return values are not string are invalid and will throw exceptions., (*3)

Authors and contributors

License

New BSD license, (*4)

Todo

  • add more functionality, but keep the library simple and easy to use (loyal to it's name)
  • create a better documentation (detail every method)
  • error handling can, and should, be improved (throw decent exceptions)
  • complete Multibyte String awareness

Using SimpleString

The idea behind SimpleString is to keep things very easy to use, while giving lot's of power to the user. Check it out:, (*5)

<?php

use Simple\Type\String;

// Example
$string = new String('Lorem ipsum dolor sit amet lorem ipsum');
$string->shorten(10);
$string->toSentenceCase();
echo $string;

// Fluent interface example
$string = new String('Lorem ipsum dolor sit amet lorem ipsum');
$string->shorten(15)->toCamelCase();
echo $string;

/**
 * SimpleString also uses overloading to create an object-oriented
 * interface for built-in string functions. Functions starting with
 * str or str_ can just be used with their actual name, not prefix.
 *
 * So: strtolower = tolower, str_replace = replace.
 *
 * Functions whose return values are not string are invalid and will
 * throw exceptions.
 */
$string = new String('Lorem ipsum dolor sit amet lorem ipsum');
$string->tolower()->replace('lorem', 'mortem');
echo $string;


The Versions

29/03 2014

dev-master

9999999-dev

A small library for object-oriented string manipulation with PHP.

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.4

 

29/03 2014

1.0.0

1.0.0.0

A small library for object-oriented string manipulation with PHP.

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.3.3