Package Data | |
---|---|
Maintainer Username: | benrowe |
Maintainer Contact: | ben.rowe.83@gmail.com (Ben Rowe) |
Package Create Date: | 2015-12-11 |
Package Last Update: | 2016-08-18 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:05:29 |
Package Statistics | |
---|---|
Total Downloads: | 441 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 2 |
Total Watchers: | 2 |
Total Forks: | 1 |
Total Open Issues: | 0 |
Provides a url generation service for your configured filesystems
This extends from laravel's filesystem config.
Simply add a dependency on benrowe/laravel-filesystem-url to your project's composer.json file if you use Composer to manage the dependencies of your project.
{
"require-dev": {
"benrowe/laravel-filesystem-url": "*"
}
}
You can also install this package via the composer command:
composer require 'benrowe/laravel-filesystem-url=*'
Once you've installed the package via composer, you need to register the provided service provider into laravel's provider stack.
Benrowe\Laravel\Url\ServiceProvider::class
Optionally you can register the facade:
'Url' => Benrowe\Laravel\Url\Facade::class,
The url builder uses the existing filesystem config, by extending it with some additional details.
Each disk
thats configured can have a url
key + associated settings
'local' => [
'url' => [
'base' => 'http://localhost',
'baseSecure' => 'https://localhost', // optional
'prefix' => 'assets', // optional
'enabled' => true, //optional
]
]
Any filesystems that don't have the url key won't allow a url to be generated (throws an exception).
The primary method is the url($path, $disk = null, $secure = false)
It can be accessed in the following ways:
Url::url('path/to/file.jpg', 'local', $forceSecure);
// outputs as http://localhost/assets/path/to/file.jpg
The package provides a convenient blade directive
@url('path/to/file.jpg', 'diskname')
// the blade directive will trap exceptions if the disk doesn't exist, or is not configured correctly.