2017 © Pedro Peláez
 

library str

String utils for PHP.

image

litgroup/str

String utils for PHP.

  • Monday, September 11, 2017
  • by Sharom
  • Repository
  • 1 Watchers
  • 0 Stars
  • 528 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 18 % Grown

The README.md

String utils for PHP 7

String utils for PHP., (*1)

Version License Downloads Build Status, (*2)

Installation

composer require litgroup/str:^0.2.1

Example of usage

UTF-8 String Manipulation

There is the class Str, which contains collection of methods for string manipulation. This methods use mb_string internally, but you should'n be worried of encoding. Str methods always work with the UTF-8 encoding., (*3)

<?php

use LitGroup\Str\Str;

Str::length('hello'); // => 5
Str::isEmpty('hello'); // => false
Str::isNotEmpty('hello'); // => true
Str::trim(' hello '); // => 'hello'
// ...

Check the code to see all methods., (*4)

Using Patterns

From time to time you need to check that a string matches to the pattern. For this purpose, this library provides the Pattern interface. RegExp is one implementation of Pattern, which represents Perl-Compatible Regular Expressions (PCRE)., (*5)

<?php

use LitGroup\Str\RegExp;

$emailPattern = new RegExp('/^\w+(?:[-+.\']\w+)*@\w+(?:[-.]\w+)*\.\w+(?:[-.]\w+)*$/Dsu');

if ($emailPattern->isSatisfiedBy('john@example.com')) {
    echo 'This is a valid email address!';
}

The Versions

11/09 2017

dev-master

9999999-dev

String utils for PHP.

  Sources   Download

MIT

The Requires

  • php ^7.1
  • ext-mbstring *

 

The Development Requires

by Roman Shamritskiy

06/09 2017

0.2.1

0.2.1.0

String utils for PHP.

  Sources   Download

MIT

The Requires

  • php ^7.1
  • ext-mbstring *

 

The Development Requires

by Roman Shamritskiy

06/09 2017

0.2.0

0.2.0.0

String utils for PHP.

  Sources   Download

MIT

The Requires

  • php ^7.1
  • ext-mbstring *

 

The Development Requires

by Roman Shamritskiy

06/09 2017

0.1.0

0.1.0.0

String utils for PHP.

  Sources   Download

MIT

The Requires

  • php ^7.1
  • ext-mbstring *

 

The Development Requires

by Roman Shamritskiy