{"id":13615079,"url":"https://github.com/rymanalu/laravel-simple-uploader","last_synced_at":"2026-01-12T01:51:33.654Z","repository":{"id":62538664,"uuid":"75953427","full_name":"rymanalu/laravel-simple-uploader","owner":"rymanalu","description":"Simple file uploader for Laravel 5.","archived":false,"fork":false,"pushed_at":"2018-11-10T11:50:47.000Z","size":30,"stargazers_count":55,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-11-27T16:28:52.501Z","etag":null,"topics":["file","laravel","php","upload","uploader"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rymanalu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-08T16:05:53.000Z","updated_at":"2025-04-19T06:53:48.000Z","dependencies_parsed_at":"2022-11-02T15:30:29.341Z","dependency_job_id":null,"html_url":"https://github.com/rymanalu/laravel-simple-uploader","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/rymanalu/laravel-simple-uploader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rymanalu%2Flaravel-simple-uploader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rymanalu%2Flaravel-simple-uploader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rymanalu%2Flaravel-simple-uploader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rymanalu%2Flaravel-simple-uploader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rymanalu","download_url":"https://codeload.github.com/rymanalu/laravel-simple-uploader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rymanalu%2Flaravel-simple-uploader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28331257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"ssl_error","status_checked_at":"2026-01-12T00:36:15.229Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file","laravel","php","upload","uploader"],"created_at":"2024-08-01T20:01:09.095Z","updated_at":"2026-01-12T01:51:33.638Z","avatar_url":"https://github.com/rymanalu.png","language":"PHP","funding_links":[],"categories":["Laravel"],"sub_categories":[],"readme":"# Laravel 5 Simple Uploader\n\n[![Build Status](https://travis-ci.org/rymanalu/laravel-simple-uploader.svg?branch=1.0)](https://travis-ci.org/rymanalu/laravel-simple-uploader) [![Total Downloads](https://poser.pugx.org/rymanalu/laravel-simple-uploader/downloads)](https://packagist.org/packages/rymanalu/laravel-simple-uploader) [![Latest Stable Version](https://poser.pugx.org/rymanalu/laravel-simple-uploader/v/stable)](https://packagist.org/packages/rymanalu/laravel-simple-uploader) [![License](https://poser.pugx.org/rymanalu/laravel-simple-uploader/license)](https://packagist.org/packages/rymanalu/laravel-simple-uploader)\n\nUploading files and store its in Filesystem / Cloud storage in Laravel 5 is not easy and simple for some developers. This package provides a simple way to do that, and comes with fluent interface that you might like.\n\n## Installation\n\nFirst, install this package via the Composer package manager:\n```\ncomposer require rymanalu/laravel-simple-uploader\n```\n\nNext, you should add the `UploaderServiceProvider` to the `providers` array of your `config/app.php` configuration file:\n```php\nRymanalu\\LaravelSimpleUploader\\UploaderServiceProvider::class,\n```\n\nDon't forget to add the `Uploader` facade to the `aliases` array for shorter code:\n```php\n'Uploader' =\u003e Rymanalu\\LaravelSimpleUploader\\Support\\Uploader::class,\n```\n\nAfter that, you should publish the Uploader configuration using the `vendor:publish` Artisan command. This command will publish the `uploader.php` configuration file to your `config` directory:\n```\nphp artisan vendor:publish --provider=\"Rymanalu\\LaravelSimpleUploader\\UploaderServiceProvider\"\n```\n\n## Configuration\nThe Uploader configuration is located at `config/uploader.php`, where you can adjust the default file provider and the default file visibility as you want.\n\n## File Providers\nThis package comes with two file providers, from HTTP request and local filesystem. Before uploading a file, you can set where the file is provided. Example:\n```php\nUploader::from('request')-\u003eupload('avatar'); // see the supported providers at config/uploader.php\n\n// Or you can use the magic methods...\nUploader::fromRequest()-\u003eupload('file');\nUploader::fromLocal()-\u003eupload('/path/to/file');\nUploader::fromUrl()-\u003eupload('https://via.placeholder.com/150.png');\n```\nIf you call method on the `Uploader` facade without first calling the `from` method, the uploader will assume that you want to use the default provider.\n```php\n// If your default provider is local, it will automatically use the local provider.\nUploader::upload('/path/to/file');\n```\n\n## Usage\n### Uploading a File\nNow, uploading a file is very simple like this:\n```php\n\u003c?php\n\nnamespace App\\Http\\Controllers;\n\nuse Uploader;\nuse Illuminate\\Http\\Request;\n\nclass UserController extends Controller\n{\n    /**\n     * Change user's avatar.\n     *\n     * @param  \\Illuminate\\Http\\Request  $request\n     * @return \\Illuminate\\Http\\Response\n     */\n    public function changeAvatar(Request $request)\n    {\n        Uploader::upload('avatar');\n\n        //\n    }\n}\n```\nThe `upload` method accept a request key or path where the file is located (based on the file provider) as first parameter and returns a boolean: `true` if succeed or `false` if failed.\n\nYou may pass a `Closure` callback as second parameter that will be called if the file successfully uploaded:\n```php\n// The parameter in the Closure is a full uploaded filename...\nUploader::upload('avatar', function ($filename) {\n    Photo::create(['photo' =\u003e $filename]);\n});\n\nUploader::upload('/path/to/file', function ($filename) {\n    $user = User::find(12);\n\n    $user-\u003eupdate(['avatar' =\u003e $filename]);\n});\n```\n\n### Choosing the File Storage\nAutomatically, the Uploader will use your default [Filesystem](https://laravel.com/docs/filesystem) Disk when storing the file. But, you can choose where you will store the file with `uploadTo` method:\n```php\n// see the supported uploadTo parameter at config/filesystems.php\nUploader::uploadTo('s3')-\u003eupload('avatar');\n\n// Or you can use the magic methods...\nUploader::uploadToS3();\nUploader::uploadToFtp();\nUploader::uploadToLocal();\nUploader::uploadToRackspace();\n```\n\n### Set the Folder\nMaybe you want to specify the folder where the file will be stored. Just use the `toFolder` method:\n```php\nUploader::toFolder('photos')-\u003eupload('photo');\n```\n\n### Rename the File\nAdjust the filename as you want with `renameTo` method:\n```php\nUploader::renameTo('my-awesome-videos')-\u003eupload('/path/to/video');\n```\nIf you ignore this method, the file will be renamed to random and unique name.\n\n### File Visibility\nYou may set the [file visibility](https://laravel.com/docs/filesystem#file-visibility) using the `setVisibility` method:\n```php\nUploader::setVisibility('public')-\u003eupload('avatar');\n```\nOr just ignore this, and the Uploader will set the visibility based on your configuration.\n\n### Method Chainning\nAll the methods above except the `upload` method, are chainable. Feel free to call other methods before calling the `upload`. Example:\n```php\nUploader::from('local')-\u003euploadToS3()-\u003etoFolder('banners')-\u003erenameTo('cool-banner')-\u003esetVisibility('public')-\u003eupload('/path/to/banner');\n```\n\n## Adding Custom File Provider\n### Implementing The Provider\nYour custom file provider should implement the `Rymanalu\\LaravelSimpleUploader\\Contracts\\Provider`. This interface contains just a few simple methods we need to implement. A stubbed Google Drive implementation looks something like this:\n\n```php\n\u003c?php\n\n// You are free to place the providers anywhere you like...\nnamespace App\\Uploader\\Providers;\n\n// Check this interface to see all the docblock for each method...\nuse Rymanalu\\LaravelSimpleUploader\\Contracts\\Provider;\n\nclass GoogleDrive implements Provider\n{\n    public function isValid() {}\n    public function getContents() {}\n    public function getExtension() {}\n    public function setFile($file) {} // Or you can use Rymanalu\\LaravelSimpleUploader\\Support\\FileSetter trait to implement this method...\n}\n```\n\n### Registering The Provider\nOnce your provider has been implemented, you are ready to register it with the `UploaderManager`. To add additional drivers to the manager, you may use the `extend` method on the `Uploader` facade. You should call the `extend` method from the boot method of a service provider. You may do this from the existing `AppServiceProvider` or create an entirely new provider:\n\n```php\n\u003c?php\n\nnamespace App\\Providers;\n\nuse App\\Uploader\\Providers\\GoogleDrive;\nuse Illuminate\\Support\\ServiceProvider;\nuse Rymanalu\\LaravelSimpleUploader\\Support\\Uploader; // Or just \"use Uploader;\" if you register the facade in the aliases array in \"config/app.php\" before...\n\nclass UploaderServiceProvider extends ServiceProvider\n{\n    /**\n     * Perform post-registration booting of services.\n     *\n     * @return void\n     */\n    public function boot()\n    {\n        Uploader::extend('gdrive', function ($app) {\n            // Return implementation of Rymanalu\\LaravelSimpleUploader\\Contracts\\Provider...\n            return new GoogleDrive;\n        });\n    }\n\n    /**\n     * Register bindings in the container.\n     *\n     * @return void\n     */\n    public function register()\n    {\n        //\n    }\n}\n```\n\nOnce the provider driver has been registered, you may use the `gdrive` driver in your `config/uploader.php` configuration file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frymanalu%2Flaravel-simple-uploader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frymanalu%2Flaravel-simple-uploader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frymanalu%2Flaravel-simple-uploader/lists"}