2017 © Pedro Peláez
 

library laravel-url-resolver-provider

Provides a Laravel 5 service provider and facade for URLResolver.php.

image

infusionweb/laravel-url-resolver-provider

Provides a Laravel 5 service provider and facade for URLResolver.php.

  • Thursday, May 19, 2016
  • by rkeppner
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,496 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel 5 URL Resolver Provider

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

A simple wrapper for using URLResolver.php in Laravel

This package provides a Laravel 5 service provider and facade for mdf/php-url-resolver, which is a fork of mattwright/URLResolver.php, which seems to no longer be maintained., (*2)

URLResolver.php is a PHP class that attempts to resolve URLs to a final, canonical link. On the web today, link shorteners, tracking codes and more can result in many different links that ultimately point to the same resource. By following HTTP redirects and parsing web pages for open graph and canonical URLs, URLResolver.php attempts to solve this issue., (*3)

When enabled and configured, all this package does is allow more convenient use of the URLResolver.php functionality, through a Laravel facade., (*4)

Installation

Step 1: Composer

Via Composer command line:, (*5)

$ composer require infusionweb/laravel-url-resolver-provider

Or add the package to your composer.json:, (*6)

{
    "require": {
        "infusionweb/laravel-url-resolver-provider": "~0.1.0"
    }
}

Step 2: Register the Service Provider

Add the service provider to your config/app.php:, (*7)

'providers' => [
    //
    InfusionWeb\Laravel\Providers\UrlResolver::class,
];

Step 3: Enable the Facade

Add the facade to your config/app.php:, (*8)

'aliases' => [
    //
    'Resolver' => InfusionWeb\Laravel\Facades\UrlResolver::class,
];

Usage

Simple case

<?php

use Resolver;

$url = 'http://bit.ly/1R6M0uY';

$resolved = Resolver::resolveURL($url)->getURL();

With additional setup

<?php

use Resolver;

// Change the default user agent.
Resolver::setUserAgent('Mozilla/5.0 (compatible; YourAppName/1.0; +http://www.example.com)');

// Set a temporary file for session cookie storage.
Resolver::setCookieJar('/tmp/url_resolver.cookies');

// Test result object for additional information.
$url = 'http://goo.gl/0GMP1';
$url_result = $resolver->resolveURL($url);
if ($url_result->didErrorOccur()) {
    print "Error resolving $url:\n  ".$url_result->getErrorMessageString();
}
else {
    print $url_result->getHTTPStatusCode().': '.$url_result->getURL();
}

For additional documentation, see the URLResolver.php documentation., (*9)

Credits

License

The MIT License (MIT). Please see License File for more information., (*10)

The Versions

19/05 2016

dev-master

9999999-dev https://github.com/infusionweb/laravel-url-resolver-provider

Provides a Laravel 5 service provider and facade for URLResolver.php.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel urlresolver phpurlresolver

19/05 2016

0.1.0

0.1.0.0 https://github.com/infusionweb/laravel-url-resolver-provider

Provides a Laravel 5 service provider and facade for URLResolver.php.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel urlresolver phpurlresolver