Skip to content

Latest commit

 

History

History
139 lines (92 loc) · 3.15 KB

README.md

File metadata and controls

139 lines (92 loc) · 3.15 KB

Ubiq Build Status

Functions for readable treatment of string, array & object.

  1. Let's code
    1.1 Simple
    1.2 Readable
    1.3 Normalized
  2. Documentation
    2.1 String manipulation
    2.2 Array manipulation
    2.3 Object manipulation
  3. How to Install
  4. How to Contribute
  5. Author & Community

Let's code

Simple

With Ubiq, your treatments are simple.

$string = 'example.com/my/path';
\UString::substrBefore( $string, '/' );
// Returns 'example.com'
// Instead of usual implementation: substr( $string, 0, strpos( $string, '/' ) );

↑ top

Readable

With Ubiq, even your complex treatments still readable.

$string = 'example.com/my/path';
\UString::substrBefore( $string, '/' );
// Returns 'example.com'
\UString::substrBefore( $string, [ '/', '.' ] );
// Returns 'example'
\UString::substrBeforeLast( $string, [ '/', '.' ] );
// Returns 'example.com/my'

↑ top

Normalized

Ubiq has consistent and normalized api.

$string = 'my/path';
// Without prefix, the method return the result of the treatment
\UString::startWith( $string, '/' );
// Returns '/my/path'
$string = 'my/path';
// With 'is' prefix, the method return the result of the test
\UString::isStartWith( $string, '/' );
// Returns FALSE
$string = 'my/path';
// With 'do' prefix, the method treat by reference
\UString::doStartWith( $string, '/' );
// $string value is now '/my/path'

↑ top

How to Install

If you don't have composer, you have to install it.

Add or complete the composer.json file at the root of your repository, like this :

{
    "require": {
        "pixel418/ubiq": "0.4.*"
    }
}

Ubiq can now be downloaded via composer.

To use it, you just have to load the composer autoloader :

require_once( './vendor/autoload.php' );

↑ top

How to Contribute

  1. Fork the Ubiq repository
  2. Create a new branch for each feature or improvement
  3. Send a pull request from each feature branch to the develop branch

If you don't know much about pull request, you can read the Github article.

All pull requests must follow the PSR1 standard and be accompanied by passing phpunit tests.

↑ top

Author & Community

Ubiq is under the MIT License.
It is created and maintained by Thomas ZILLIOX.

↑ top