PHPackages                             codeflextech/laravel-uploader - 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. codeflextech/laravel-uploader

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

codeflextech/laravel-uploader
=============================

Reusable Laravel uploader with DB tracking, polymorphic relations, S3 support &amp; optimization

2.0.0(3mo ago)011MITPHPPHP ^8.1

Since Jan 15Pushed 2mo agoCompare

[ Source](https://github.com/codeflextech/laravel-uploader)[ Packagist](https://packagist.org/packages/codeflextech/laravel-uploader)[ RSS](/packages/codeflextech-laravel-uploader/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

CodeFlexTech Laravel Uploader
=============================

[](#codeflextech-laravel-uploader)

A production-ready Laravel file uploader with:

- Polymorphic relations
- Public &amp; private files
- Local / S3 support
- Image optimization
- Auto cleanup on model delete
- **Multiple File Types Support**

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

[](#installation)

composer require codeflextech/laravel-uploader

```

## Configuration

Publish the config file to customize defaults:

```bash
php artisan vendor:publish --tag=uploader-config

```

### Key Config Options (`config/uploader.php`)

[](#key-config-options-configuploaderphp)

- **`table_name`**: The database table name (default: `files`). Can be set via `UPLOAD_TABLE_NAME` env var.
- **`disk`**: Default storage disk (e.g., `public`, `s3`).
- **`folder`**: Default folder name inside the disk (default: `uploads`).
- **`structure`**: Date structure for organized files (default: `year/month/week`).
- **`visibility`**: File visibility (`public` or `private`).
- **`optimize_images`**: Auto-resize images (boolean).

Direct Public Uploads
---------------------

[](#direct-public-uploads)

By default, files are stored in `storage/app/public` and symlinked. If you want to upload **directly** to the `public/` folder (bypassing `storage/`), you can define a custom disk.

1. Add to `config/filesystems.php`:

    ```
    'public_uploads' => [
        'driver' => 'local',
        'root'   => public_path('uploads'), // Uploads to public/uploads
        'url'    => env('APP_URL').'/uploads',
        'visibility' => 'public',
    ],
    ```
2. Use it in your upload:

    ```
    $user->upload($file, ['disk' => 'public_uploads']);
    ```

Basic Usage
-----------

[](#basic-usage)

### 1. Add Trait to Model

[](#1-add-trait-to-model)

Add the `HasFiles` trait to any model that should have files attached (e.g., User, Post, Product).

```
use CodeFlexTech\Uploader\Traits\HasFiles;

class User extends Authenticatable
{
    use HasFiles;
}
```

### 2. Upload a File

[](#2-upload-a-file)

Use the `FileUploader` facade or class to handle uploads.

```
```php
// Old way (still works)
// FileUploader::upload($request->file('avatar'), $user, [...]);

// New, cleaner way
$user->upload(
    $request->file('avatar'),
    [
        'folder' => 'avatars',
        'disk'   => 'public',
        'type'   => 'profile_pic'
    ]
);
```

Advanced Usage: File Types &amp; Validation
-------------------------------------------

[](#advanced-usage-file-types--validation)

You can categorize uploads by `type` (e.g., 'resume', 'profile\_pic').

### 1. Upload with Type

[](#1-upload-with-type)

Pass the `type` in the options array. If omitted, it defaults to `'file'`.

```
FileUploader::upload($file, $user, ['type' => 'resume']);
```

### 2. Retrieve Files by Type

[](#2-retrieve-files-by-type)

The `HasFiles` trait provides helper methods:

```
// Get all resumes
$resumes = $user->filesByType('resume')->get();

// Get the latest profile picture
$pic = $user->latestFile('profile_pic');
```

License
-------

[](#license)

MIT

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance82

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~24 days

Total

2

Last Release

99d ago

Major Versions

v1.0.0 → 2.0.02026-02-08

### Community

Maintainers

![](https://www.gravatar.com/avatar/8d32db310c4a2ed2c4ed1f265fda786c1bea15d998f33c88e854680e36960d85?d=identicon)[faisalshah4004](/maintainers/faisalshah4004)

---

Top Contributors

[![faisalshah4004](https://avatars.githubusercontent.com/u/125204538?v=4)](https://github.com/faisalshah4004 "faisalshah4004 (4 commits)")

### Embed Badge

![Health badge](/badges/codeflextech-laravel-uploader/health.svg)

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

###  Alternatives

[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.3M74](/packages/unisharp-laravel-filemanager)[barryvdh/elfinder-flysystem-driver

A Flysystem Driver for elFinder

1864.7M31](/packages/barryvdh-elfinder-flysystem-driver)[itskodinger/midia

Simple Media manager for your Laravel project

1415.8k](/packages/itskodinger-midia)[jeremytubbs/deepzoom

Deepzoom Tile Generator for OpenSeadragon

5018.7k2](/packages/jeremytubbs-deepzoom)[farhanshares/laravel-mediaman

MediaMan - The most elegant &amp; powerful media management package for Laravel!

293.7k](/packages/farhanshares-laravel-mediaman)[xefi/faker-php-images

Faker extension to generate images

402.6k](/packages/xefi-faker-php-images)

PHPackages © 2026

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