{"id":17922699,"url":"https://github.com/overtrue/laravel-uploader","last_synced_at":"2025-04-08T09:08:28.804Z","repository":{"id":51547952,"uuid":"73438622","full_name":"overtrue/laravel-uploader","owner":"overtrue","description":":palm_tree: An upload component for Laravel.","archived":false,"fork":false,"pushed_at":"2024-10-08T21:26:24.000Z","size":514,"stargazers_count":137,"open_issues_count":1,"forks_count":20,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-01T07:52:06.621Z","etag":null,"topics":["laravel","laravel-upload","laravel-uploader"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/overtrue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["overtrue"]}},"created_at":"2016-11-11T02:24:09.000Z","updated_at":"2025-01-15T15:08:20.000Z","dependencies_parsed_at":"2024-02-17T06:30:53.630Z","dependency_job_id":"1e02e053-1e32-4fff-b193-bc1254c7e241","html_url":"https://github.com/overtrue/laravel-uploader","commit_stats":{"total_commits":107,"total_committers":7,"mean_commits":"15.285714285714286","dds":"0.10280373831775702","last_synced_commit":"184f537092acd2b6a6150aa08c879e839eaae1f9"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtrue%2Flaravel-uploader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtrue%2Flaravel-uploader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtrue%2Flaravel-uploader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtrue%2Flaravel-uploader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/overtrue","download_url":"https://codeload.github.com/overtrue/laravel-uploader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247809962,"owners_count":20999816,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["laravel","laravel-upload","laravel-uploader"],"created_at":"2024-10-28T20:40:29.869Z","updated_at":"2025-04-08T09:08:28.786Z","avatar_url":"https://github.com/overtrue.png","language":"PHP","funding_links":["https://github.com/sponsors/overtrue"],"categories":[],"sub_categories":[],"readme":"# Laravel Uploader\n\n:palm_tree: An upload component for Laravel.\n\n[![Sponsor me](https://github.com/overtrue/overtrue/blob/master/sponsor-me-button-s.svg?raw=true)](https://github.com/sponsors/overtrue)\n\n## Installing\n\n1. Install package: \n\n    ```sh\n    $ composer require overtrue/laravel-uploader -vvv\n    ```\n\n    and publish the assets using command:\n\n    ```sh\n    $ php artisan vendor:publish --provider=Overtrue\\\\LaravelUploader\\\\UploadServiceProvider\n    ```\n\n2. Routing\n\n    You can register routes in `routes/web.php` or other routes file:\n\n    ```php\n    \\LaravelUploader::routes();\n    \n    // custom\n    \\LaravelUploader::routes([\n       'as' =\u003e 'files.upload', \n       'middleware' =\u003e ['auth'],\n       //...\n    ]); \n    ```\n\n## Usage\n\n### Custom controller\n\nIf you want to handle file upload, you can do it as simple as:\n\n```php\n\u003c?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\nuse Illuminate\\Routing\\Controller as BaseController;\nuse Overtrue\\LaravelUploader\\StrategyResolver;\n\nclass MyUploadController extends BaseController\n{\n    public function upload(Request $request)\n    {\n        return StrategyResolver::resolveFromRequest($request, $request-\u003eget('strategy', 'default'))-\u003eupload();\n    }\n}\n``` \n\n### Custom Response\n\nIf you want update the response, you can get key information from the return value object and return a new response:\n\n```php\n    public function upload(Request $request)\n    {\n        $response = StrategyResolver::resolveFromRequest($request, $request-\u003eget('strategy', 'default'))-\u003eupload();\n        \n        return response()-\u003ejson([\n            'status' =\u003e 'success',\n            'url' =\u003e $response-\u003eurl,\n            'origin_name' =\u003e $response-\u003eoriginalName,\n            //...\n        ]);\n    }\n```\n\nYou can get all these public properties:\n\n```php\nint $size;\nstring $path;\nstring $mime;\nstring $url;\nstring $relativeUrl;\nstring $filename;\nstring $originalName;\n\\Illuminate\\Http\\UploadedFile   $file;\n\\Overtrue\\LaravelUploader\\Strategy $strategy;\n```\n\n## Recommend clients\n\n- [Element UI - Upload](https://element.eleme.cn/#/zh-CN/component/upload)\n- [Plupload](https://www.plupload.com/)\n- [Dropzone](https://www.dropzonejs.com/)\n\n\n## :heart: Sponsor me \n\n[![Sponsor me](https://github.com/overtrue/overtrue/blob/master/sponsor-me.svg?raw=true)](https://github.com/sponsors/overtrue)\n\n如果你喜欢我的项目并想支持它，[点击这里 :heart:](https://github.com/sponsors/overtrue)\n\n\n## Project supported by JetBrains\n\nMany thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects.\n\n[![](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)](https://www.jetbrains.com/?from=https://github.com/overtrue)\n\n## PHP 扩展包开发\n\n\u003e 想知道如何从零开始构建 PHP 扩展包？\n\u003e\n\u003e 请关注我的实战课程，我会在此课程中分享一些扩展开发经验 —— [《PHP 扩展包实战教程 - 从入门到发布》](https://learnku.com/courses/creating-package)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fovertrue%2Flaravel-uploader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fovertrue%2Flaravel-uploader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fovertrue%2Flaravel-uploader/lists"}