PHPackages                             heryfitiavana/rcu-laravel - 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. heryfitiavana/rcu-laravel

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

heryfitiavana/rcu-laravel
=========================

Resumable chunk upload for Laravel

v1.0.0(1y ago)011MITPHP

Since Jul 1Pushed 1y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

rcu-laravel
===========

[](#rcu-laravel)

[Resumable chunk upload](https://github.com/heryfitiavana22/resumable-chunk-upload) for Laravel.

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

[](#installation)

Via composer :

```
composer require heryfitiavana/rcu-laravel
```

Usage
-----

[](#usage)

### CSRF

[](#csrf)

Add the csrf token to the Uploader in frontend

```
// get csrf token from meta tag :
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute("content");

new Uploader()
    .setHeaders({
        "X-CSRF-TOKEN": csrfToken,
    })
    /// ... others
```

### Defining Routes

[](#defining-routes)

Add the following routes to your `routes/web.php` file:

```
use Heryfitiavana\RCU\Controllers\UploadController;

Route::get('/uploadStatus', [UploadController::class, 'uploadStatus']);
Route::post('/upload', [UploadController::class, 'upload']);
```

Default RCU configuration : [RCUConfig](#rcuconfig)

 ### Custom RCU configuration

[](#custom-rcu-configuration)

### Custom RCU configuration

[](#custom-rcu-configuration-1)

You can customize the package's behavior by defining a custom configuration array. Here's an example:

```
$customConfig = [
    "store" => new JsonStoreProvider('rcu/uploads.json'),
    "tmpDir" => "rcu/tmp",
    "outputDir" => "rcu/output",
    "onCompleted" => function ($data) {
    },
];
```

### Use the configuration

[](#use-the-configuration)

Go to `app/Providers/AppServiceProvider.php` and add the following code

```
use Illuminate\Support\ServiceProvider;
use Heryfitiavana\RCU\Controllers\RCUControllerFactory;
use Heryfitiavana\RCU\Controllers\UploadController;
use Heryfitiavana\RCU\StoreProviders\JsonStoreProvider;

class AppServiceProvider extends ServiceProvider
{
    public function register()
    {
        // other ...
        $this->app->singleton(UploadController::class, function ($app) {
            $customConfig = [
                "store" => new JsonStoreProvider('rcu/uploads.json'),
                "tmpDir" => "rcu/tmp",
                "outputDir" => "rcu/output",
                "onCompleted" => function ($data) {
                },
            ];
            return RCUControllerFactory::createController($customConfig);
        });
    }

    public function boot()
    {
    }
}
```

API
---

[](#api)

### RCUConfig

[](#rcuconfig-)

```
[
    "store" => new JsonStoreProvider('rcu/uploads.json'),
    "tmpDir" => "rcu/tmp",
    "outputDir" => "rcu/output",
    "onCompleted" => function ($data) {
    },
]
```

#### store

[](#store)

- Type: `StoreProviderInterface`
- Default: `JsonStoreProvider`

The `store` parameter is used to store information about the upload, such as the number of the last uploaded chunk, the total number of chunks, etc. The default store is JSON, but you can implement your own by implementing the [StoreProviderInterface](#storeproviderinterface).

#### tmpDir

[](#tmpdir)

- Type: `string`
- Default: `rcu/tmp`

Directory to save all binary chunks.

#### outputDir

[](#outputdir)

- Type: `string`
- Default: `rcu/output`

Directory to save the complete file.

#### onCompleted

[](#oncompleted)

- Type: `(data: ['outputFile' => string, 'fileId' => string]) => void`

This callback function can be used to perform any additional actions or operations after the upload is completed, such as updating a database record or sending a notification.

- `outputFile`: Path of the uploaded file.
- `fileId`: The ID of the file used to identify the upload. This is specified from [frontend](/guide/frontend-api#setfileid).

### StoreProviderInterface

[](#storeproviderinterface-)

```
Upload = [
    "id" => string,
    "chunkCount" => int,
    "lastUploadedChunkNumber": int,
    "chunkFilenames": string[],
];

interface StoreProviderInterface
{
    public function getItem(String $id) : Upload | undefined;
    public function createItem(String $id, Int $chunkCount): Upload;
    public function updateItem(String $id, Upload $update) : Upload;
    public function removeItem(String $id) : void;
}
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

681d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d3ecbfe21c0b746e87701da7be58cb512611b4e58f6420aa632aebe716686da8?d=identicon)[heryfitiavana](/maintainers/heryfitiavana)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/heryfitiavana-rcu-laravel/health.svg)

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

###  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)[sopamo/laravel-filepond

Laravel backend module for filepond uploads

215272.2k3](/packages/sopamo-laravel-filepond)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[konekt/html

HTML and Form Builders for the Laravel Framework

24403.2k5](/packages/konekt-html)[dragon-code/laravel-http-logger

Logging incoming HTTP requests

319.8k3](/packages/dragon-code-laravel-http-logger)[bjuppa/laravel-blog

Add blog functionality to your Laravel project

483.3k2](/packages/bjuppa-laravel-blog)

PHPackages © 2026

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