2017 © Pedro Peláez
 

library urlpruner

This library takes in an URL and prunes it from (probably) unnecessary data

image

tzfrs/urlpruner

This library takes in an URL and prunes it from (probably) unnecessary data

  • Friday, January 15, 2016
  • by tzfrs
  • Repository
  • 1 Watchers
  • 17 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

URL Pruner

An easy-to-use library to prune URLs, (*1)

Install

Install via composer:, (*2)

composer require tzfrs\urlpruner

Run composer install or composer update., (*3)

Methods

anythingAfter - Removes everything from the URL after a character/word, (*4)

regex - Removes parts of the URL based on the Regex, (*5)

parameters - Removes parameters with specific keys, (*6)

allParameters - Removes all parameters, (*7)

parameterValues - Removes all parameters with keys that have a specific value, (*8)

prune - Actually performs the pruning, (*9)

Getting Started

Basic pruning

<?php
require __DIR__ . '/vendor/autoload.php';

$url = 'https://www.google.de/search?num=30&site=&source=hp&q=software+development&oq=Software+Development&gs_l=hp.3.0.0l10.464.4794.0.5387.31.18.3.7.8.0.185.1953.1j14.15.0....0...1c.1.64.hp..8.23.1779.0._BnKQF4413M';

$urlPruner = new \tzfrs\URLPruner\URLPruner();

print $urlPruner->anythingAfter('search')
    ->prune($url); // https://www.google.de/search

print $urlPruner->regex('search')
    ->prune($url); // https://www.google.de/?num=30&site=&source=hp&q=software+development&oq=Software+Development&gs_l=hp.3.0.0l10.464.4794.0.5387.31.18.3.7.8.0.185.1953.1j14.15.0....0...1c.1.64.hp..8.23.1779.0._BnKQF4413M

print $urlPruner->parameters(['num', 'q'])
    ->prune($url); // https://www.google.de/search?site=&source=hp&oq=Software+Development&gs_l=hp.3.0.0l10.464.4794.0.5387.31.18.3.7.8.0.185.1953.1j14.15.0....0...1c.1.64.hp..8.23.1779.0._BnKQF4413M

print $urlPruner->allParameters()
    ->prune($url); // https://www.google.de/search

print $urlPruner->parameterValues(['30', '', 'hp'])
    ->prune($url); // https://www.google.de/search?q=software+development&oq=Software+Development&gs_l=hp.3.0.0l10.464.4794.0.5387.31.18.3.7.8.0.185.1953.1j14.15.0....0...1c.1.64.hp..8.23.1779.0._BnKQF4413M

Contributing is surely allowed! :-), (*10)

See the file LICENSE for licensing informations, (*11)

The Versions

15/01 2016

dev-master

9999999-dev

This library takes in an URL and prunes it from (probably) unnecessary data

  Sources   Download

MIT

The Development Requires

08/01 2016

1.2

1.2.0.0

This library takes in an URL and prunes it from (probably) unnecessary data

  Sources   Download

MIT

The Development Requires

08/01 2016

1.1

1.1.0.0

This library takes in an URL and prunes it from (probably) unnecessary data

  Sources   Download

MIT

The Development Requires

08/01 2016

1.0

1.0.0.0

This library takes in an URL and prunes it from (probably) unnecessary data

  Sources   Download

MIT

The Development Requires