pixel418 / ubiq
Functions for readable treatment of string, array & object
Installs: 27 093
Dependents: 3
Suggesters: 0
Security: 0
Stars: 9
Watchers: 1
Forks: 1
Open Issues: 1
Requires
- php: >=5.3.0
README
Functions for readable treatment of string, array & object.
- Let's code
1.1 Simple
1.2 Readable
1.3 Normalized - Documentation
2.1 String manipulation
2.2 Array manipulation
2.3 Object manipulation - How to Install
- How to Contribute
- 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, '/' ) );
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'
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'
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' );
How to Contribute
- Fork the Ubiq repository
- Create a new branch for each feature or improvement
- 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.
Author & Community
Ubiq is under the MIT License.
It is created and maintained by Thomas ZILLIOX.