PHPackages                             hostkurd/flocms-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. hostkurd/flocms-uploader

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

hostkurd/flocms-uploader
========================

Professional file and image upload package for FloCMS with local, private and S3-ready storage drivers.

v1.0.0(3mo ago)0161MITPHPPHP &gt;=8.1

Since Mar 16Pushed 3mo agoCompare

[ Source](https://github.com/hostkurd/flocms-uploader)[ Packagist](https://packagist.org/packages/hostkurd/flocms-uploader)[ RSS](/packages/hostkurd-flocms-uploader/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)DependenciesVersions (2)Used By (1)

FloCMS Uploader
===============

[](#flocms-uploader)

`hostkurd/flocms-uploader` is a production-ready upload package for FloCMS. It supports:

- local public uploads
- local private uploads
- AWS S3 uploads
- secure MIME and extension validation
- random filenames by default
- optional original-name preservation
- date-based folders
- single and multi-file uploads
- image resizing, fitting, optimization, and version generation
- GD or Imagick image drivers

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

[](#installation)

```
composer require hostkurd/flocms-uploader
```

For AWS S3 support:

```
composer require aws/aws-sdk-php
```

Recommended FloCMS structure
----------------------------

[](#recommended-flocms-structure)

- `public/uploads` for publicly accessible assets like avatars, post images, and product photos.
- `storage/uploads` for protected files like invoices, reports, and private user documents.

Configure the package
---------------------

[](#configure-the-package)

Create `config/upload.php` in your FloCMS app and copy the example from this package.

```
use FloCMS\Uploader\Uploader;

Uploader::configure(require ROOT . '/config/upload.php');
```

A good place to do that is inside your bootstrap sequence, right after your framework loads config.

Example config
--------------

[](#example-config)

```
return [
    'default_disk' => 'public',
    'disks' => [
        'public' => [
            'driver' => 'local',
            'root' => ROOT . '/public/uploads',
            'url' => '/uploads',
            'visibility' => 'public',
        ],
        'private' => [
            'driver' => 'local',
            'root' => ROOT . '/storage/uploads',
            'visibility' => 'private',
        ],
        's3' => [
            'driver' => 's3',
            'key' => getenv('AWS_ACCESS_KEY_ID') ?: '',
            'secret' => getenv('AWS_SECRET_ACCESS_KEY') ?: '',
            'region' => getenv('AWS_DEFAULT_REGION') ?: 'us-east-1',
            'bucket' => getenv('AWS_BUCKET') ?: '',
            'url' => getenv('AWS_URL') ?: null,
            'prefix' => 'uploads',
            'visibility' => 'public',
        ],
    ],
];
```

Basic file upload
-----------------

[](#basic-file-upload)

```
use FloCMS\Uploader\Uploader;

Uploader::configure(require ROOT . '/config/upload.php');

$result = Uploader::disk('public')
    ->directory('documents')
    ->useDatePath()
    ->allowExtensions(['pdf', 'docx', 'jpg', 'jpeg', 'png'])
    ->maxBytes(10 * 1024 * 1024)
    ->upload($_FILES['attachment']);

$fileData = $result->toArray();
```

### Directory selection

[](#directory-selection)

You can choose the target directory per upload:

```
Uploader::disk('public')->directory('avatars')->upload($_FILES['avatar']);
Uploader::disk('private')->directory('invoices')->upload($_FILES['invoice']);
```

### Multiple uploads

[](#multiple-uploads)

```
$results = Uploader::disk('public')
    ->directory('gallery')
    ->uploadMany($_FILES['images']);
```

Image uploads with versions
---------------------------

[](#image-uploads-with-versions)

```
$result = Uploader::image()
    ->onDisk('public')
    ->directory('posts')
    ->useDatePath()
    ->maxBytes(5 * 1024 * 1024)
    ->versions([
        'large' => ['resize' => [1600, 1600]],
        'medium' => ['resize' => [800, 800]],
        'thumb' => ['fit' => [300, 300], 'format' => 'webp', 'quality' => 82],
    ])
    ->upload($_FILES['image']);

$thumbUrl = $result->versionUrl('thumb');
```

The original image is kept by default and stored under:

```
posts/2026/03/original/abc123.jpg

```

Generated versions are stored like:

```
posts/2026/03/large/abc123.jpg
posts/2026/03/medium/abc123.jpg
posts/2026/03/thumb/abc123.webp

```

AWS S3 example
--------------

[](#aws-s3-example)

```
$result = Uploader::disk('s3')
    ->directory('products')
    ->useDatePath()
    ->allowExtensions(['jpg', 'jpeg', 'png', 'webp'])
    ->upload($_FILES['image']);
```

Security notes
--------------

[](#security-notes)

- The package validates upload errors before moving files.
- It uses `finfo` to detect MIME type.
- It validates file extension and MIME type independently.
- It uses random filenames by default.
- It validates real images with `getimagesize()` before image processing.
- It does not support SVG sanitization. Do not allow SVG uploads until you add a sanitizer.

Public API overview
-------------------

[](#public-api-overview)

### `FloCMS\Uploader\Uploader`

[](#flocmsuploaderuploader)

- `configure(array $config): void`
- `disk(string $disk): Uploader`
- `make(?array $config = null): Uploader`
- `onDisk(string $disk): self`
- `directory(string $directory): self`
- `to(string $directory): self`
- `useDatePath(bool $enabled = true): self`
- `preserveOriginalName(bool $enabled = true): self`
- `filename(string $filename): self`
- `visibility(string $visibility): self`
- `allowExtensions(array $extensions): self`
- `allowMimeTypes(array $mimes): self`
- `maxBytes(int $bytes): self`
- `imageDimensions(array $dimensions): self`
- `upload(array $file, ?string $directory = null): UploadResult`
- `uploadMany(array $files, ?string $directory = null): array`

### `FloCMS\Uploader\Image\ImageUploader`

[](#flocmsuploaderimageimageuploader)

- `versions(array $versions): self`
- `keepOriginal(bool $enabled = true): self`
- `optimize(bool $enabled = true): self`
- `quality(int $quality): self`
- `driver(string $driver): self`

FloCMS integration suggestion
-----------------------------

[](#flocms-integration-suggestion)

Inside your bootstrap after config is loaded:

```
use FloCMS\Uploader\Uploader;

if (is_file(ROOT . '/config/upload.php')) {
    Uploader::configure(require ROOT . '/config/upload.php');
}
```

Then your controllers can use the package directly.

Notes
-----

[](#notes)

- `Uploader::disk('public')` is the clean entry point for regular files.
- `Uploader::image()->onDisk('public')` is the clean entry point for image processing.
- If you want a framework-level helper later, you can wrap this package with your own `upload()` or `uploader()` helper in FloCMS core.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance82

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

100d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14282027?v=4)[Khalat](/maintainers/Khalat)[@khalat](https://github.com/khalat)

---

Top Contributors

[![sarmad-qadir](https://avatars.githubusercontent.com/u/223909750?v=4)](https://github.com/sarmad-qadir "sarmad-qadir (5 commits)")

---

Tags

s3storageimagesuploaduploaderflocms

### Embed Badge

![Health badge](/badges/hostkurd-flocms-uploader/health.svg)

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

###  Alternatives

[league/flysystem

File storage abstraction for PHP

13.6k665.7M2.4k](/packages/league-flysystem)[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.7k277.8M959](/packages/league-flysystem-aws-s3-v3)[vinelab/cdn

Content Delivery Network (CDN) Package for Laravel

217242.9k1](/packages/vinelab-cdn)[league/flysystem-async-aws-s3

AsyncAws S3 filesystem adapter for Flysystem.

2711.6M40](/packages/league-flysystem-async-aws-s3)[fof/upload

The file upload extension for the Flarum forum with insane intelligence.

190185.4k17](/packages/fof-upload)[eddturtle/direct-upload

Composer Package to build an AWS Signature ready to Direct Upload to S3

88747.0k2](/packages/eddturtle-direct-upload)

PHPackages © 2026

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