PHPackages                             unisharp/laravel-uploadable - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. unisharp/laravel-uploadable

ActiveLibrary[File &amp; Storage](/categories/file-storage)

unisharp/laravel-uploadable
===========================

A simple package to attach files to a eloquent model.

53.0k2PHP

Since Nov 19Pushed 7y ago9 watchersCompare

[ Source](https://github.com/UniSharp/laravel-uploadable)[ Packagist](https://packagist.org/packages/unisharp/laravel-uploadable)[ RSS](/packages/unisharp-laravel-uploadable/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Uploadable
==========

[](#uploadable)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4af01d415aefe4e83619c110fb8005837024ee10e679247a97c264bafc112309/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f556e6953686172702f6c61726176656c2d75706c6f616461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/unisharp/laravel-uploadable)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/ac288a586a19b44f629483098a8709bfca4c9babca9d00bf0e23d02046a170f8/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f556e6953686172702f6c61726176656c2d75706c6f616461626c652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/UniSharp/laravel-uploadable)[![Coverage Status](https://camo.githubusercontent.com/d8981ab20d64bca9ce62fa7f5d709e9933c836fd0252eb12a604217eb854de03/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f556e6953686172702f6c61726176656c2d75706c6f616461626c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/UniSharp/laravel-uploadable/code-structure)[![Quality Score](https://camo.githubusercontent.com/ce3f1fe751e82e6625e14f44b4b61f706b1c004e2c50cb20a332fc0c254e3586/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f556e6953686172702f6c61726176656c2d75706c6f616461626c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/UniSharp/laravel-uploadable)[![Total Downloads](https://camo.githubusercontent.com/9a14eb22b0f1b0112f55c0a9350143a1bc0aaea462e12582b627120afcb0f0de/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f556e6953686172702f6c61726176656c2d75706c6f616461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/UniSharp/laravel-uploadable)

A simple package to attach files to a eloquent model.

Installation
------------

[](#installation)

```
composer require unisharp/laravel-uploadable dev-master

```

Configuration
-------------

[](#configuration)

Set configuration in `config/uploadable.php`

```
return [
    // Set image orientate enable or disable
    'use_image_orientate' => false,

    // Set thumbnail size
    'thumbs' => [
        's' => '96x96',
        'm' => '256x256',
        'l' => '480x480'
    ],

    // Set image handler
    'plugins' => [
        ImageHandler::class
    ]
];
```

Usages
------

[](#usages)

### Use trait in the model

[](#use-trait-in-the-model)

```
namespace App;

use Illuminate\Database\Eloquent\Model;
use Unisharp\Uploadable\CanUpload;

class Product extends Model
{
    use CanUpload;

    public function image()
    {
        return $this->morphOne(Image::class, 'imageable');
    }
}
```

### Manually upload and Delete files

[](#manually-upload-and-delete-files)

```
// Upload a file
$product = new Product();
$product->upload(request()->file());

// Delete a file
$file = $product->files()->first();
$product->removeFiles($file->id);

// Delete files
$files = $product->files->pluck('id');
$product->removeFiles($files);
```

### Upload/Delete through APIs

[](#uploaddelete-through-apis)

```
// POST /files/ & DELETE /files/{file}
UniSharp\Uploadable\UploaderManager::route();

// POST /files/
UniSharp\Uploadable\UploaderManager::route(['store']);

// POST /files/ with callback
UniSharp\Uploadable\UploaderManager::route(['store'], function () {
    ...
});
```

### Customize image handler

[](#customize-image-handler)

Image Handler

```
use Intervention\Image\Facades\Image;
use Illuminate\Filesystem\FilesystemAdapter;

class CustomImageHandler {
    public function handle(FilesystemAdapter $storage, $path)
    {
        $image = Image::make($storage->path($path));

        ...

        $image->save();
    }
}
```

Set Custom image handler in `config/uploadable.php`

```
return [
    'plugins' => [
        CustomImageHandler::class
    ]
];
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/49773ea5050ec1d004a506cc1e11be08d6e87339120b5d223b8921e3f671153c?d=identicon)[g0110280](/maintainers/g0110280)

---

Top Contributors

[![CatheCat](https://avatars.githubusercontent.com/u/14325344?v=4)](https://github.com/CatheCat "CatheCat (14 commits)")[![streamtw](https://avatars.githubusercontent.com/u/7333171?v=4)](https://github.com/streamtw "streamtw (9 commits)")[![youchenlee](https://avatars.githubusercontent.com/u/181350?v=4)](https://github.com/youchenlee "youchenlee (9 commits)")[![bluehaha2](https://avatars.githubusercontent.com/u/26923948?v=4)](https://github.com/bluehaha2 "bluehaha2 (8 commits)")[![storyn26383](https://avatars.githubusercontent.com/u/6954098?v=4)](https://github.com/storyn26383 "storyn26383 (7 commits)")

### Embed Badge

![Health badge](/badges/unisharp-laravel-uploadable/health.svg)

```
[![Health](https://phpackages.com/badges/unisharp-laravel-uploadable/health.svg)](https://phpackages.com/packages/unisharp-laravel-uploadable)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M124](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
