Package Data | |
---|---|
Maintainer Username: | nodes |
Maintainer Contact: | cr@nodes.dk (Casper Rasmussen) |
Package Create Date: | 2015-11-08 |
Package Last Update: | 2020-04-23 |
Home Page: | http://nodesagency.com |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-04-19 15:03:20 |
Package Statistics | |
---|---|
Total Downloads: | 11,237 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 3 |
Total Watchers: | 3 |
Total Forks: | 4 |
Total Open Issues: | 3 |
A easy integration for handling files with Laravel.
One thing we at Nodes have been missing in Laravel is a fast easy file storage integration system.
The Storage
facade made it easier, but we still need the option to upload from differente formats and store to a very specific folder structure, retrieve a path and be able to create urls to serve api and sites.
To install this package you will need:
You must then modify your composer.json
file and run composer update
to include the latest version of the package in your project.
"require": {
"nodes/assets": "^1.1"
}
Or you can run the composer require command from your terminal.
composer require nodes/assets:^1.1
Setup service provider in config/app.php
Nodes\Assets\ServiceProvider::class
Setup alias in config/app.php
'Assets' => Nodes\Assets\Support\Facades\Assets::class
Publish config files
php artisan vendor:publish --provider="Nodes\Assets\ServiceProvider"
If you want to overwrite any existing config files use the --force
parameter
php artisan vendor:publish --provider="Nodes\Assets\ServiceProvider" --force
Public folder method can resize images. To setup, you need Intervention image lib. To install run
composer require intervention/image
Then add the following to app.php
providers array
Intervention\Image\ImageServiceProvider::class
aliases array
'Image' => Intervention\Image\Facades\Image::class
finally run
php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravel5"
Modify the configuration in config/nodes/assets/general.php
return [
'upload' => [
'provider' => function () {
return new \Nodes\Assets\Upload\Providers\PublicFolder();
},
],
'url' => [
'provider' => function () {
return new \Nodes\Assets\Url\Providers\PublicFolder();
},
],
];
function assets_add($file, $folder = null, UploadSettings $settings = null)
function assets_add_uploaded_file(UploadedFile $file, $folder = null, UploadSettings $settings = null)
function assets_add_url($url, $folder = null, UploadSettings $settings = null)
function assets_add_data_uri($dataUri, $folder = null, UploadSettings $settings = null)
function assets_get($path, UrlSettings $settings = null)
Assets::add($file, $folder = null, UploadSettings $settings = null)
Assets::addFromUploadedFile(UploadedFile $file, $folder = null, UploadSettings $settings = null)
Assets::addFromUrl($url, $folder = null, UploadSettings $settings = null)
Assets::addFromDataUri($dataUri, $folder = null, UploadSettings $settings = null)
Assets::get($path)
This package is developed and maintained by the PHP team at Nodes
This package is open-sourced software licensed under the MIT license