Package Data | |
---|---|
Maintainer Username: | Sukohi |
Maintainer Contact: | test@example.com (Sukohi) |
Package Create Date: | 2016-12-15 |
Package Last Update: | 2017-01-30 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:08:45 |
Package Statistics | |
---|---|
Total Downloads: | 28 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
A Laravel package to generate absolute URL.
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
]
// 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
This package is licensed under the MIT License.
Copyright 2016 Sukohi Kuhoh