PHPackages                             bkwld/upchuck - 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. bkwld/upchuck

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

bkwld/upchuck
=============

A simple, automatic handler of file uploads for Laravel's Eloquent models using using Flysystem.

2.6.1(5y ago)2313.7k42MITPHPPHP &gt;=5.5.0

Since Apr 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/BKWLD/upchuck)[ Packagist](https://packagist.org/packages/bkwld/upchuck)[ RSS](/packages/bkwld-upchuck/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (4)Versions (27)Used By (2)

Upchuck
=======

[](#upchuck)

[![Packagist](https://camo.githubusercontent.com/abe6927491f1685336318ab461c58a962552a181d2ca41ca2df876d1605dc748/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626b776c642f7570636875636b2e737667)](https://packagist.org/packages/bkwld/upchuck)

Upchuck is a simple, automatic handler of file uploads for [Laravel's](http://laravel.com/) [Eloquent](http://laravel.com/docs/eloquent) models using using [Flysystem](http://flysystem.thephpleague.com/). It does not attempt to do anything besides let the developer treat file uploads like regular input fields. It does this by listening to Eloquent `saving` events, checking the model attribute for `UploadedFile` instances, pushing those files to "disk" of your choosing, and then storing the publically accessible URL in the model attribute for that input.

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

[](#installation)

1. Add to your project: `composer require bkwld/upchuck:~2.0`
2. *Laravel &lt; 5.5 only* Add Upchuck as a provider in your app/config/app.php's provider list: `'Bkwld\Upchuck\ServiceProvider',`
3. Publish the config: `php artisan vendor:publish --provider="Bkwld\Upchuck\ServiceProvider"`

Usage
-----

[](#usage)

Edit the `disk` config setting to supply configuration information for where uploads should be moved. We are using [Graham Campbell's Flysystem](https://github.com/GrahamCampbell/Laravel-Flysystem) integration for Laravel to instantiate Flysystem instances, so the configruation of the `disk` matches his [configuration options for connections](https://github.com/GrahamCampbell/Laravel-Flysystem/blob/1.0/src/config/config.php#L38). As the comments in the config file mention, I recommend turning on caching if you are using any disk other than `local`. For both [caching](https://github.com/thephpleague/flysystem-cached-adapter) and [other disk drivers](https://github.com/thephpleague/flysystem#adapters), you will need to include other packages.

Then, to enable upload support for your models, use the `Bkwld\Upchuck\SupportsUploads` trait on your model and itemize each attribute that should support uploads via the `$upload_attributes` property. For example:

```
class Person extends Eloquent {

	// Use the trait
	use Bkwld\Upchuck\SupportsUploads;

	// Define the uploadable attributes
	protected $upload_attributes = [ 'image', 'pdf', ];

	// Since the upload handling happens via model events, it acts like a mass
	// assignment.  As such, Upchuck sets attributes via `fill()` so you can
	// control the setting.
	protected $fillable = ['image', 'pdf'];
}
```

Then, say you have a `` field, you would do this from your controller:

```
$model = new Model;
$model->fill(Input::all())
$model->save();
```

You are filling the object with the `Input:all()` array, which includes your image data as an `UploadedFile` object keyed to the `image` attribute. When you `save()`, Upchuck will act on the `saving` event, moving the upload into the storage you've defined in the config file, and replacing the attribute value with the URL of the file.

### Resizing images

[](#resizing-images)

If your app supports uploading files you are probably also dealing with needing to resize uploaded images. We (BKWLD) use our [Croppa](https://github.com/BKWLD/croppa) package to resize images using specially formatted URLs. If you are looking for an model-upload package that also resizes images, you might want to check out [Stapler](https://github.com/CodeSleeve/stapler).

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 96.3% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~99 days

Total

26

Last Release

1626d ago

Major Versions

1.1.4 → 2.0.02016-01-22

1.2.0 → 2.0.12016-08-23

1.2.1 → 2.1.02017-04-10

PHP version history (2 changes)1.1.0PHP &gt;=5.4.0

2.0.0PHP &gt;=5.5.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/77567?v=4)[Robert Reinhard](/maintainers/weotch)[@weotch](https://github.com/weotch)

---

Top Contributors

[![weotch](https://avatars.githubusercontent.com/u/77567?v=4)](https://github.com/weotch "weotch (79 commits)")[![brokenhd](https://avatars.githubusercontent.com/u/2153609?v=4)](https://github.com/brokenhd "brokenhd (3 commits)")

### Embed Badge

![Health badge](/badges/bkwld-upchuck/health.svg)

```
[![Health](https://phpackages.com/badges/bkwld-upchuck/health.svg)](https://phpackages.com/packages/bkwld-upchuck)
```

###  Alternatives

[laravel/scout

Laravel Scout provides a driver based solution to searching your Eloquent models.

1.7k55.0M619](/packages/laravel-scout)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M131](/packages/laravel-pulse)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)[rapidez/core

Rapidez Core

1823.5k72](/packages/rapidez-core)

PHPackages © 2026

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