2017 © Pedro Peláez
 

library string-middleware

Plugin based string manipulator

image

waynestate/string-middleware

Plugin based string manipulator

  • Tuesday, October 20, 2015
  • by nickdenardis
  • Repository
  • 10 Watchers
  • 0 Stars
  • 10,018 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 7 % Grown

The README.md

PHP String Manipulation Middleware

Plugin based string manipulator, (*1)

Build Status, (*2)

Installation

To install this library, run the command below and you will get the latest version, (*3)

composer require waynestate/string-middleware

Usage

// Start with some string
$input = 'Some string to parse';

// Create the instance of the Parser
$parser = new \Waynestate\ParserMiddleware\ParserMiddleware();

// Define the list of parsers to run, in chronological order
// Each must implement the Waynestate\StringParser\StringParserInterface
$parsers = array(
    'Waynestate\StringParser\SelfParser',
    'Waynestate\StringParsers\ReverseParser',
);

// Set the stack of parsers
$parser->setStack($parsers);

// Parse the string and return the output
$output = $parser->parse($input);

// Output is now modified by each parser
var_dump($output);

Example Parser

Reverse a string, (*4)

/**
 * Class Header Parser
 */
class HeaderParser implements Waynestate\StringParser\StringParserInterface
{
    /**
     * Replace every occurrence of "<p>[header ...]</p>" with "<h1>...</h1>"
     *
     * @param string $string
     * @return string
     */
    public function parse($string) {
        return preg_replace("/<p>\[header (.*)\]<\/p>/", '<h1>${1}</h1>', $string);
    }
}

Tests

phpunit

Code Coverage

phpunit --coverage-html ./coverage

The Versions

20/10 2015

dev-feature/test-travis-ci-container

dev-feature/test-travis-ci-container http://github.com/waynestate/string-middleware

Plugin based string manipulator

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

16/06 2015

dev-master

9999999-dev http://github.com/waynestate/string-middleware

Plugin based string manipulator

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

16/06 2015

dev-develop

dev-develop http://github.com/waynestate/string-middleware

Plugin based string manipulator

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

16/06 2015

1.1.2

1.1.2.0 http://github.com/waynestate/string-middleware

Plugin based string manipulator

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

16/06 2015

dev-feature/setposition

dev-feature/setposition http://github.com/waynestate/string-middleware

Plugin based string manipulator

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

24/03 2015

1.1.1

1.1.1.0 http://github.com/waynestate/string-middleware

Plugin based string manipulator

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

24/03 2015

1.1.0

1.1.0.0 http://github.com/waynestate/string-middleware

Plugin based string manipulator

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

18/03 2015

1.0.0

1.0.0.0 http://github.com/waynestate/string-middleware

Plugin based string manipulator

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

15/02 2015

0.1.1

0.1.1.0 http://github.com/nickdenardis/string-middleware

Plugin based string manipulator

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

15/02 2015

0.1.0

0.1.0.0 http://github.com/nickdenardis/string-middleware

Plugin based string manipulator

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires