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(2y 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 yesterday

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

21

—

LowBetter than 18% of packages

Maintenance27

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

732d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17964605?v=4)[Hery Fitiavana](/maintainers/heryfitiavana)[@heryfitiavana](https://github.com/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

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[intervention/image-laravel

Laravel Integration of Intervention Image

1588.9M182](/packages/intervention-image-laravel)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k20](/packages/fleetbase-core-api)

PHPackages © 2026

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