2017 © Pedro Peláez
 

library url-helper

A simple library for handling path of url and matching url easily

image

prob/url-helper

A simple library for handling path of url and matching url easily

  • Saturday, September 10, 2016
  • by jongpak
  • Repository
  • 1 Watchers
  • 1 Stars
  • 299 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Prob/Url

A simple library for handling path of url and matching url easily, (*1)

Build Status codecov, (*2)

Usage

Simple path parser

Path class is separating url segments, (*3)

<?php

use Prob\Url\Path;

$path = new Path('/apple/banana');

echo $path->seg(0);             // apple
echo $path->seg(1);             // banana

print_r($path->segments());     // Array ( 'apple', 'banana' )

Simple url matching

Matchar class is checking the url matching, (*4)

<?php

use Prob\Url\Matcher;

$pathA = new Matcher('/apple');
print_r($pathA->match('/apple'));         // Array ( )
print_r($pathA->match('/banana'));        // false

$pathB = new Matcher('/apple/banana');
print_r($pathB->match('/apple/banana'));  // Array ( )
print_r($pathB->match('/apple'));         // false
print_r($pathB->match('/banana'));        // false

$pathC = new Matcher('/{board}/{post:int}');
print_r($pathC->match('/free/5'));        // Array ( 'board' => 'free', 'post' => '5' )
print_r($pathC->match('/free'));          // false
print_r($pathC->match('/free/some'));     // false

support type

  • string
  • int

The Versions

10/09 2016

dev-master

9999999-dev https://github.com/jongpak/prob-url

A simple library for handling path of url and matching url easily

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

url path match