unreal4u/string-operations

This class is a collection of functions that deals with strings

v1.1.0 2014-03-24 22:11 UTC

README

Latest Stable Version Build Status Scrutinizer Code Quality License

stringOperations.php

Credits

This class is made by unreal4u (Camilo Sperberg). unreal4u.com/

About this class

  • Originally conceived to be a receiver of all loose string-related functions that I've made throughout the years
  • Later also a playground to learn about multibyte capabilities of strings

Detailed description

This package is a collection of functions related to string manipulation.

Basic usage

include('src/unreal4u/stringOperations.php');
$stringOperations = new unreal4u\stringOperations();
$result = $stringOperations->truncate('this is a bigger text', 15);
  • Congratulations! Result will have a truncated string, compatible with UTF-8 characters:
 this is a bigger...
 
  • Please see examples and PHPUnit tests for more options and advanced usage

Composer

This class has support for Composer install. Just add the following section to your composer.json with:

{
    "require": {
        "unreal4u/string-operations": "@stable"
    }
}

Now you can instantiate a new stringOperations class by executing:

require('vendor/autoload.php');

$stringOperations = new unreal4u\stringOperations();

Pending

  • Search for more loose functions spattered around my codebase
  • Improve the usage of the internal used charset
  • Consistent usage of the class and it subcomponents (UTF-8 in createSlug)
  • Multiple arguments for separator in truncate function
  • Use transliterate instead of htmlentities (Will produce BC!)

Version History

  • 0.1:
    • Created class
  • 0.1.1:
    • Documentation fixes
  • 0.2.0:
    • Added decomposeCompleteEmail() function and unit tests for it
  • 0.2.2:
    • Documentation update
  • 0.3.0:
    • Composer compatibility
    • Documentation and examples update
  • 0.3.1:
    • Renamed repo and moved PHPUnit as dependency
  • 0.3.2:
    • Travis-CI support
    • Gitattributes
    • Documentation fixes
  • 1.0.0:
    • Truncate function improvements and BC breaks
      • This function can now search backwards in the string
      • This function now supports multiple separators
    • Excluded some things from the auto generated release packages
  • 1.1.0:
    • Class doesn't rely anymore on imap functions, so no more need for imap extension!
    • Update to PHPUnit 4.0
    • Added PHP 5.3 to the battery test

Contact the author