PHPackages                             mohamedsamy902/advanced-file-upload - 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. mohamedsamy902/advanced-file-upload

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

mohamedsamy902/advanced-file-upload
===================================

A comprehensive file upload package for Laravel with cloud storage and image processing

022PHPCI failing

Since Apr 4Pushed 1mo agoCompare

[ Source](https://github.com/MohamedSamy902/uplade-file-chunk)[ Packagist](https://packagist.org/packages/mohamedsamy902/advanced-file-upload)[ RSS](/packages/mohamedsamy902-advanced-file-upload/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

AdvancedFileUpload for Laravel
==============================

[](#advancedfileupload-for-laravel)

**A comprehensive file upload package for Laravel**, supporting local and cloud storage, image processing, file compression, format conversion, and much more.

---

🚀 Features
----------

[](#-features)

- ✅ **API &amp; HTML Uploads** — Seamless integration for both API endpoints and HTML forms.
- ☁️ **Cloud Storage Support** — S3, Google Cloud Storage, and any Laravel-supported disk.
- 🖼️ **Image Processing** — Resize, watermark, apply filters, convert to WebP/AVIF (via Intervention Image).
- 🖼️ **Automatic Thumbnails** — Generate thumbnails in custom sizes.
- 🗜️ **File Compression** — Compress PDFs, DOCX, and other docs (requires external tools).
- 📦 **Chunked Uploads** — Handle large files with Pion Laravel Chunk Upload.
- 📊 **Quota System** — Set storage limits per user.
- 🔗 **CDN Support** — Serve files via your preferred CDN.
- 🧩 **Database Integration** — Store metadata for uploaded files (optional).
- 🧪 **Unit Testing** — PHPUnit coverage included.

---

📦 Requirements
--------------

[](#-requirements)

- PHP &gt;= 8.0
- Laravel &gt;= 9.0
- Composer

---

⚙️ Installation
---------------

[](#️-installation)

1. **Install the package via Composer:**

    ```
    composer require mohamedsamy902/advanced-file-upload:dev-main
    ```
2. **Publish the config file:**

    ```
    php artisan vendor:publish --tag=config
    ```
3. **(Optional)** Publish and run the migration:

    ```
    php artisan vendor:publish --tag=migrations
    php artisan migrate
    ```
4. **Configure your `.env` file:**

    ```
    FILE_UPLOAD_DISK=s3
    FILE_UPLOAD_DB_ENABLED=true
    FILE_UPLOAD_CDN_ENABLED=true
    FILE_UPLOAD_CDN_URL=https://your-cdn.com
    ```

---

🔧 Configuration
---------------

[](#-configuration)

Edit `config/file-upload.php` to customize:

SectionDescription**Storage**Choose disk (local, s3, gcs), base path, and organization structure.**Validation**Define file rules by type: image, video, document, etc.**Image Handling**Enable resizing, filters, watermarks, format conversion (e.g., WebP).**Thumbnails**Set custom sizes (e.g., `small`, `medium`, `large`).**Compression**Enable file compression by MIME type or extension.**Quota**Set storage limits per user ID.**CDN**Enable CDN URLs and base path for serving uploaded assets.---

💡 Usage
-------

[](#-usage)

### Upload via Controller

[](#upload-via-controller)

```
use MohamedSamy902\AdvancedFileUpload\Facades\FileUpload;

public function uploadFile(Request $request)
{
    $result = FileUpload::upload($request, 'profile_picture', [
        'convert_to' => 'webp',
    ]);

    return response()->json($result);
}
```

### Download Image Or Video By Url

[](#download-image-or-video-by-url)

```
public function download()
{
    $result = FileUpload::upload([], [
      'url' => 'http://Example.com/vwdio.mp4',
    ]);

    return response()->json($result);
}
```

### Delete a File

[](#delete-a-file)

```
public function deleteFile($idOrPath)
{
    $result = FileUpload::delete($idOrPath);

    return response()->json($result);
}
```

---

🧾 HTML Form Example
-------------------

[](#-html-form-example)

```

  @csrf

  Upload

```

---

🧪 API Example
-------------

[](#-api-example)

```
curl -X POST http://your-app.com/upload \
  -F "profile_picture=@/path/to/image.jpg"
```

### Response

[](#response)

```
{
  "path": "uploads/2025/06/23/uuid.jpg",
  "url": "https://your-cdn.com/uploads/2025/06/23/uuid.jpg",
  "thumbnail_urls": {
    "small": "https://your-cdn.com/uploads/2025/06/23/thumb_small_uuid.jpg",
    "medium": "https://your-cdn.com/uploads/2025/06/23/thumb_medium_uuid.jpg"
  },
  "mime_type": "image/jpeg"
}
```

---

🧪 Testing
---------

[](#-testing)

Run PHPUnit tests:

```
vendor/bin/phpunit
```

---

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome!
Please submit pull requests or open issues via [GitHub Issues](https://github.com/your-vendor/advanced-file-upload/issues).

---

📄 License
---------

[](#-license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

---

📘 Usage Guide (Arabic)
----------------------

[](#-usage-guide-arabic)

### طريقة الاستخدام

[](#طريقة-الاستخدام)

#### 1. إنشاء الباكدج

[](#1-إنشاء-الباكدج)

- أنشئ مجلدًا باسم `advanced-file-upload`.
- ضع الملفات ضمن الهيكلية المناسبة.
- استبدل `your-vendor` باسمك أو اسم شركتك في الملفات و`composer.json`.

#### 2. نشر الباكدج

[](#2-نشر-الباكدج)

- أنشئ مستودع GitHub.
- اربطه مع [Packagist](https://packagist.org) لنشر الباكدج.
- حدّث `composer.json` باسمك كمزود.

#### 3. تثبيت الباكدج في مشروع Laravel

[](#3-تثبيت-الباكدج-في-مشروع-laravel)

```
composer require your-vendor/advanced-file-upload
```

#### 4. إعداد التخزين السحابي

[](#4-إعداد-التخزين-السحابي)

- أضف تعريف S3 أو GCS في `config/filesystems.php`.
- ضبّط بيانات الاعتماد في `.env`.

#### 5. اختبار الباكدج

[](#5-اختبار-الباكدج)

```
vendor/bin/phpunit
```

---

🧩 الميزات التفصيلية
-------------------

[](#-الميزات-التفصيلية)

الميزةالوصفالتخزين السحابييدعم S3، Google Cloud، وغيرها عبر Laravel Filesystem.معالجة الصورتغيير الحجم، العلامة المائية، فلاتر، تحويل إلى WebP/AVIF.الصور المصغرةإنشاء تلقائي لأحجام متعددة.ضغط الملفاتضغط ملفات PDF و DOCX (يتطلب أدوات خارجية).نظام الكوتاتعيين حدود تخزين لكل مستخدم.دعم CDNتقديم الملفات عبر شبكة CDN.قاعدة البياناتتخزين بيانات الملفات اختياريًا في جدول مرتبط.الرفع المجزأدعم رفع الملفات الكبيرة باستخدام `Pion Laravel Chunk Upload`.New
---

[](#new)

AdvancedFileUpload for Laravel
==============================

[](#advancedfileupload-for-laravel-1)

**A comprehensive file upload package for Laravel**, supporting local and cloud storage, image processing, file compression, format conversion, chunked uploads, ready-to-use Blade UI, and more.

---

🚀 Features
----------

[](#-features-1)

- ✅ **API &amp; HTML Uploads** — Seamless integration for both API endpoints and HTML forms.
- ☁️ **Cloud Storage Support** — S3, Google Cloud Storage, and any Laravel-supported disk.
- 🖼️ **Image Processing** — Resize, watermark, apply filters, convert to WebP/AVIF (via Intervention Image).
- 🖼️ **Automatic Thumbnails** — Generate thumbnails in custom sizes.
- 🗜️ **File Compression** — Compress PDFs, DOCX, and other docs (requires external tools).
- 📦 **Chunked Uploads** — Handle large files with Pion Laravel Chunk Upload.
- 📊 **Quota System** — Set storage limits per user.
- 🔗 **CDN Support** — Serve files via your preferred CDN.
- 🧩 **Database Integration** — Store metadata for uploaded files (optional).
- 🎨 **Ready Blade UI** — Plug-and-play Blade upload form with chunked JS &amp; CSS, easily customizable.
- 🧪 **Unit Testing** — PHPUnit coverage included.

---

📦 Requirements
--------------

[](#-requirements-1)

- PHP &gt;= 8.0
- Laravel &gt;= 9.0
- Composer

---

⚙️ Installation
---------------

[](#️-installation-1)

1. **Install the package via Composer:**

    ```
    composer require mohamedsamy902/advanced-file-upload:dev-main
    ```
2. **Publish the config file:**

    ```
    php artisan vendor:publish --tag=config
    ```
3. **(Optional)** Publish and run the migration:

    ```
    php artisan vendor:publish --tag=migrations
    php artisan migrate
    ```
4. **(Optional)** Publish Blade, JS, and CSS for customization:

    ```
    php artisan vendor:publish --tag=views
    php artisan vendor:publish --tag=public
    ```
5. **Configure your `.env` file:**

    ```
    FILE_UPLOAD_DISK=public
    FILE_UPLOAD_DB_ENABLED=true
    FILE_UPLOAD_CDN_ENABLED=false
    FILE_UPLOAD_CDN_URL=
    ```

---

🔧 Configuration
---------------

[](#-configuration-1)

Edit `config/file-upload.php` to customize:

SectionDescription**Storage**Choose disk (local, s3, gcs), base path, and organization structure.**Validation**Define file rules by type: image, video, document, etc.**Image Handling**Enable resizing, filters, watermarks, format conversion (e.g., WebP).**Thumbnails**Set custom sizes (e.g., `small`, `medium`, `large`).**Compression**Enable file compression by MIME type or extension.**Quota**Set storage limits per user ID.**CDN**Enable CDN URLs and base path for serving uploaded assets.---

💡 Usage &amp; Examples
----------------------

[](#-usage--examples)

### 1. **Upload via Controller (Single File)**

[](#1-upload-via-controller-single-file)

```
use MohamedSamy902\AdvancedFileUpload\Facades\FileUpload;

public function upload(Request $request)
{
    $result = FileUpload::upload($request);
    return response()->json($result);
}
```

**HTML Form:**

```

    @csrf

    رفع

```

---

### 2. **Upload Multiple Files**

[](#2-upload-multiple-files)

```
public function upload(Request $request)
{
    $result = FileUpload::upload($request, ['field_name' => 'files']);
    return response()->json($result);
}
```

**HTML:**

```

    @csrf

    رفع

```

---

### 3. **Upload from URL**

[](#3-upload-from-url)

```
$result = FileUpload::upload([], [
    'url' => 'https://example.com/image.jpg',
]);
```

---

### 4. **Use the Ready Blade Upload UI**

[](#4-use-the-ready-blade-upload-ui)

Just add in your Blade view:

```
@include('advanced-file-upload::upload')
```

Or after publishing:

```
@include('vendor.advanced-file-upload.upload')
```

- This will include the ready HTML, JS, and CSS for chunked uploads and progress bar.
- You can customize the UI by editing the published files.

---

### 5. **Chunked Upload with JS (Large Files)**

[](#5-chunked-upload-with-js-large-files)

The included JS (`advanced-file-upload.js`) supports chunked uploads out of the box.
You can use it directly or customize it after publishing.

**Example:**

```

رفع

```

---

### 6. **Customize Validation, Processing, or Storage**

[](#6-customize-validation-processing-or-storage)

```
$result = FileUpload::upload($request, [
    'convert_to' => 'webp',
    'validation_rules' => [
        'file' => 'required|image|max:2048'
    ],
    'folder_name' => 'avatars'
]);
```

---

### 7. **Delete Files**

[](#7-delete-files)

```
// Delete by path
FileUpload::delete('uploads/default/uuid.jpg');

// Delete by database ID (if DB enabled)
FileUpload::delete(5);

// Delete multiple files
FileUpload::delete(['uploads/default/uuid1.jpg', 'uploads/default/uuid2.jpg']);
```

---

### 8. **Access Thumbnails**

[](#8-access-thumbnails)

```
$result = FileUpload::upload($request);
$thumbUrl = $result['thumbnail_urls']['small'] ?? null;
```

---

### 9. **CDN Support**

[](#9-cdn-support)

If you enable CDN in your config:

```
// config/file-upload.php
'cdn' => [
    'enabled' => true,
    'url' => 'https://your-cdn.com',
],
```

All returned URLs will use your CDN domain.

---

### 10. **Database Integration**

[](#10-database-integration)

If enabled, every upload will be saved in the `file_uploads` table.
You can access file metadata using the model:

```
use MohamedSamy902\AdvancedFileUpload\Models\FileUpload;

$files = FileUpload::where('user_id', auth()->id())->get();
```

---

### 11. **Quota System**

[](#11-quota-system)

Set per-user quota in config:

```
// config/file-upload.php
'quota' => [
    'enabled' => true,
    'max_size_per_user' => 1073741824, // 1GB
],
```

If a user exceeds their quota, an exception will be thrown.

---

### 12. **Customize Blade, JS, and CSS**

[](#12-customize-blade-js-and-css)

After publishing:

```
php artisan vendor:publish --tag=views
php artisan vendor:publish --tag=public
```

- Edit `resources/views/vendor/advanced-file-upload/upload.blade.php`
- Edit `public/vendor/advanced-file-upload/advanced-file-upload.css`
- Edit `public/vendor/advanced-file-upload/advanced-file-upload.js`

---

🧪 Testing
---------

[](#-testing-1)

Run PHPUnit tests:

```
vendor/bin/phpunit
```

---

🤝 Contributing
--------------

[](#-contributing-1)

Contributions are welcome!
Please submit pull requests or open issues via [GitHub Issues](https://github.com/your-vendor/advanced-file-upload/issues).

---

📄 License
---------

[](#-license-1)

This package is open-sourced software licensed under the [MIT license](LICENSE).

---

📘 Usage Guide (Arabic)
----------------------

[](#-usage-guide-arabic-1)

### أمثلة الاستخدام

[](#أمثلة-الاستخدام)

#### رفع ملف من فورم HTML

[](#رفع-ملف-من-فورم-html)

```

    @csrf

    رفع

```

#### رفع ملف من رابط

[](#رفع-ملف-من-رابط)

```
$result = FileUpload::upload([], ['url' => 'https://example.com/image.jpg']);
```

#### استخدام واجهة Blade الجاهزة

[](#استخدام-واجهة-blade-الجاهزة)

```
@include('advanced-file-upload::upload')
```

#### حذف ملف

[](#حذف-ملف)

```
FileUpload::delete('uploads/default/uuid.jpg');
```

#### تخصيص الاستايل

[](#تخصيص-الاستايل)

بعد النشر:

- عدل CSS/JS في `public/vendor/advanced-file-upload/`
- عدل Blade في `resources/views/vendor/advanced-file-upload/`

---

🧩 الميزات التفصيلية
-------------------

[](#-الميزات-التفصيلية-1)

الميزةالوصفالتخزين السحابييدعم S3، Google Cloud، وغيرها عبر Laravel Filesystem.معالجة الصورتغيير الحجم، العلامة المائية، فلاتر، تحويل إلى WebP/AVIF.الصور المصغرةإنشاء تلقائي لأحجام متعددة.ضغط الملفاتضغط ملفات PDF و DOCX (يتطلب أدوات خارجية).نظام الكوتاتعيين حدود تخزين لكل مستخدم.دعم CDNتقديم الملفات عبر شبكة CDN.قاعدة البياناتتخزين بيانات الملفات اختياريًا في جدول مرتبط.الرفع المجزأدعم رفع الملفات الكبيرة باستخدام `Pion Laravel Chunk Upload`.Blade UIواجهة Blade جاهزة وقابلة للتخصيص.تخصيص كاملCSS/JS/Blade قابل للنشر والتعديل بسهولة.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance61

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5d98cf8596705cca03e6df2e50abd48d909cb6671ba7c8c9b6ae999ac60194b0?d=identicon)[MohamedSamy902](/maintainers/MohamedSamy902)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/mohamedsamy902-advanced-file-upload/health.svg)

```
[![Health](https://phpackages.com/badges/mohamedsamy902-advanced-file-upload/health.svg)](https://phpackages.com/packages/mohamedsamy902-advanced-file-upload)
```

###  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.8M125](/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)
