2017 © Pedro Peláez
 

library component-core-stringutils

Offers operations on the data type string as a PHP component.

image

duanyong/component-core-stringutils

Offers operations on the data type string as a PHP component.

  • Thursday, July 20, 2017
  • by duanyong
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 1 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Component\Core\StringUtils

Component\Core\StringUtils is a simple-to-use PHP component that provides operations on the data type string., (*1)

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight Coverage Status, (*2)

Latest Stable Version Total Downloads Monthly Downloads Daily Downloads Latest Unstable Version License, (*3)

Stories in Ready Dependency Status Dependencies Status HHVM Status, (*4)

Table of Contents (ToC)

Introduction

Introduction

The [string functions][100] of the PHP scripting language are not consistent:, (*5)

  • Some function names begin with str, e. g. strpos.
  • Some function names begin with str_, e. g. str_rot13.
  • Some function names do not begin with str, e. g. trim and substr.

Quite a lot of the built-in string functions are only Wrapper Functions for the string functions of the underlying C programming language. Therefore a lot of useful string functions are not included in the PHP standard library., (*6)

Component\Core\StringUtils offers static classes that offer operations on the data type string. The goal of this project is to create an unified and simplified Application Programming Interface (API) for string functions to use in the PHP scripting language., (*7)

This project is inspired by the following Java classes from the [Apache Commons Lang Application Programming Interface (API)][101]:, (*8)

  • [StringUtils][102]
  • [WordUtils][103]
  • [CharUtils][104]
  • [RandomStringUtils][105]

The implementation has been adapted and abstracted for PHP., (*9)

Features

  • The class [StringUtils][106] offers operations (currently 39 methods) on the data type string.
  • The class [WordUtils][107] offers operations (currently 7 methods) on the data type string that contain words.
  • The class [CharUtils][108] offers operations (currently 18 methods) on characters.
  • The class [RandomStringUtils][109] offers operations (currently 7 methods) for random strings.
  • Artifacts tested with both static and dynamic test procedures:
    • Dynamic component tests (unit and integration tests) implemented with [PHPUnit][41].
    • Static code analysis performed using the following tools:
      • [PHP_CodeSniffer][40]: Style Checker
      • [PHP Mess Detector (PHPMD)][44]: Code Analyzer
      • [PHP Depend][45]: Code Metrics
      • [phpcpd][42]: Copy/Paste Detector (CPD)
      • [phpdcd][43]: Dead Code Detector (DCD)
      • [SensioLabs Security Checker][47]: Security Checker
    • Continuous Integration (CI) using the following web services:
  • Provides a Packagist package which can be installed using the dependency manager Composer. Click [here][51] for the package on Packagist.
  • Provides a complete Application Programming Interface (API) documentation generated with the documentation generator [Sami][46]. Click [here][52] for the API documentation.
  • Follows the following "standards" from the PHP Framework Interoperability Group (FIG). PSR stands for PHP Standards Recommendation:, (*10)

    • PSR-0: Autoloading Standards, (*11)

      Aims to provide a standard file, class and namespace convention to allow plug-and-play code., (*12)

    • PSR-1: Basic Coding Standard, (*13)

      Aims to ensure a high level of technical interoperability between shared PHP code., (*14)

    • PSR-2: Coding Style Guide, (*15)

      Provides a Coding Style Guide for projects looking to standardize their code., (*16)

    • PSR-4: Autoloader, (*17)

      A more modern take on autoloading reflecting advances in the ecosystem., (*18)

  • Follows the Semantic Versioning (SemVer) specification version 2.0.0.

Requirements

Production

Development

  • [PHPUnit][41]
  • [phpcpd][42]
  • [phpdcd][43]
  • [PHP_CodeSniffer][40]
  • [PHP Mess Detector (PHPMD)][44]
  • [Sami][46]
  • [SensioLabs Security Checker][47]
  • [php-coveralls][48]

Installation

Component\Util\Singleton should be installed using the dependency manager Composer., (*19)

Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs and it will install them in your project for you., (*20)

The Composer installer can be downloaded with php., (*21)

php -r "readfile('https://getcomposer.org/installer');" | php

This will just check a few PHP settings and then download composer.phar to your working directory. This file is the Composer binary. It is a PHAR , which is an archive format for PHP which can be run on the command line, amongst other things., (*22)

To resolve and download dependencies, run the install command:, (*23)

php composer.phar install

If you are creating a component that relies on Component\Util\Singleton, please make sure that you add Component\Util\Singleton to your component's composer.json file:, (*24)

{
    "require": {
        "duanyong/component-core-stringutils": "0.4.*"
    }
}

Usage

The best documentation for Component\Core\StringUtils are the unit tests, which are shipped in the package., (*25)

Component\Core\StringUtils contains static classes only. Therefore instances of the classes can not be constructed., (*26)

Instead, the classes should be used as:, (*27)

StringUtils::trim(' foo ');
WordUtils::wrap('foo bar', 20);

Testing

phpunit

Contributing

Please see CONTRIBUTING for details., (*28)

Credits

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version., (*29)

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details., (*30)

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see https://gnu.org/licenses/lgpl.txt., (*31)

The Versions

01/07 2013

v0.3.1

0.3.1.0 http://github.com/FlorianWolters/PHP-Component-Core-StringUtils

Offers operations on the data type string as a PHP component.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3

 

language helper wrapper string

29/06 2013

v0.3.0

0.3.0.0 http://github.com/FlorianWolters/PHP-Component-Core-StringUtils

Offers operations on the data type string as a PHP component.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3

 

language helper wrapper string

18/02 2013

v0.2.0-beta

0.2.0.0-beta http://github.com/FlorianWolters/PHP-Component-Core-StringUtils

Offers operations on the data type string.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3

 

language helper wrapper string

27/09 2012

v0.1.0-beta

0.1.0.0-beta http://github.com/FlorianWolters/PHP-Component-Core-StringUtils

Offers operations on the data type string.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.0

 

language helper wrapper string