sukohi/laravel-absolute-url

A Laravel package to generate absolute URL.
32
Install
composer require sukohi/laravel-absolute-url
Latest Version:1.0.1
License:MIT
Last Updated:Jan 30, 2017
Links: GitHub  ·  Packagist
Maintainer: Sukohi

laravel-absolute-url

A Laravel package to generate absolute URL.

Installation

Execute the following composer command.

composer require sukohi/laravel-absolute-url:1.*

Register the service provider in app.php

'providers' => [
    ...Others...,  
    Sukohi\LaravelAbsoluteUrl\LaravelAbsoluteUrlServiceProvider::class, 
]

Also alias

'aliases' => [
    ...Others...,  
    'LaravelAbsoluteUrl' => Sukohi\LaravelAbsoluteUrl\Facades\LaravelAbsoluteUrl::class
]

Usage

// 1. Set Base URL

$base_url = 'http://example.com/1/2/3/';
$absolute_path = \LaravelAbsoluteUrl::baseUrl($base_url);

// 2. Get Absolute URL

echo $absolute_path->get('/test.html');  // http://example.com/test.html
echo $absolute_path->get('../test.html');  // http://example.com/1/2/test.html
echo $absolute_path->get('./test.html');  // http://example.com/1/2/3/test.html
echo $absolute_path->get('test.html');  // http://example.com/1/2/3/test.html

License

This package is licensed under the MIT License.

Copyright 2016 Sukohi Kuhoh

Related Packages

erirk/paypalpayment

laravel-paypalpayment is simple package help you process direct credit card paym...

0
gabrieloliverio/laravel5-generators

Database metadata-based generators for Laravel 5

1
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

622,487,850 9,703
laravel/framework

The Laravel Framework.

568,663,231 34,884
laravel/tinker

Powerful REPL for the Laravel framework.

478,440,860 7,440