2017 © Pedro PelĂĄez
 

library longuevue

A simple contents extractor

image

pyrsmk/longuevue

A simple contents extractor

  • Tuesday, August 2, 2016
  • by pyrsmk
  • Repository
  • 1 Watchers
  • 0 Stars
  • 381 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

LongueVue 0.1.6

LongueVue is now unmaintained. If you're searching for a web scraper, use Goutte. If you're looking for a router, take a look at FastRoute., (*1)

LongueVue is a contents extractor built on top of preg_match(). Concretely, you can extract any string contents from anything, like discover articles on some blog to create a RSS stream per example., (*2)

Installing

Pick up the source or install it with Composer :, (*3)

composer require pyrsmk/longuevue

Matching and extracting

The pattern is a chain with {var} variables. If the chain matches, then the values are extracted :, (*4)

$longuevue=new LongueVue('/articles/{id}/comments');
// Will return false
$longuevue->match('/articles');
// Will return false too
$longuevue->match('/articles//comments');
// Will return array('id'=>'72')
$longuevue->match('/articles/72/comments');
// Will return array()
$longuevue->match('/articles//comments');

Validators

You can add a validator to the engine for a specific value. If that value does not match the regex validator, then the entire chain won't match at all., (*5)

$longuevue=new LongueVue('/articles/{id}/comments');
$longuevue->addValidator('id','\d+');
// Match
$longuevue->match('/articles/72/comments');
// Won't match
$longuevue->match('/articles/some_article/comments');

Default values

Also, if the chain can have some missing values, you can declare default ones :, (*6)

$longuevue=new LongueVue('/articles/{id}/comments');
$longuevue->addDefaultValue('id','1');
// Will return array('id'=>'72')
$longuevue->match('/articles/72/comments');
// Will return array('id'=>'1')
$longuevue->match('/articles//comments');

License

LongueVue is published under the MIT license., (*7)

The Versions

02/08 2016

dev-master

9999999-dev

A simple contents extractor

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

pattern content data extract contents

26/05 2016

0.1.6

0.1.6.0

A simple contents extractor

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

pattern content data extract contents

16/09 2015

0.1.5

0.1.5.0

A simple contents extractor

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

pattern content data extract contents

16/09 2015

0.1.3

0.1.3.0

A simple contents extractor

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

pattern content data extract contents

14/03 2015

0.1.2

0.1.2.0

A simple contents extractor

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

pattern content data extract contents

27/01 2015

0.1.1

0.1.1.0

A simple contents extractor

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

pattern content data extract contents

05/03 2014

0.1.0

0.1.0.0

A simple contents extractor

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

pattern content data extract contents