PHPackages                             kanata-php/forklift - 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. kanata-php/forklift

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

kanata-php/forklift
===================

Livewire package to move models around.

0.1.1(3y ago)0103MITPHP

Since Sep 11Pushed 3y ago1 watchersCompare

[ Source](https://github.com/kanata-php/forklift)[ Packagist](https://packagist.org/packages/kanata-php/forklift)[ GitHub Sponsors](https://github.com/kanata-php)[ RSS](/packages/kanata-php-forklift/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (6)Used By (0)

[![](./docs/forklift.png)](./docs/forklift.png)

Forklift
========

[](#forklift)

[![Tests](https://github.com/kanata-php/forklift/actions/workflows/php.yml/badge.svg)](https://github.com/kanata-php/forklift/actions/workflows/php.yml)[![Code Coverage](https://camo.githubusercontent.com/49c1fb6902f7364fbf2dbfb37dc8645000460fbfaf3b81ca1cfc83ea366f2529/68747470733a2f2f636f6465636f762e696f2f67682f6b616e6174612d7068702f666f726b6c6966742f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d4245414c374d4c464641)](https://codecov.io/gh/kanata-php/forklift)

> Laravel Livewire Component

[![](./docs/screenshot.png)](./docs/screenshot.png)

```
composer require kanata-php/forklift
```

Move assets in a predictable and easy manner with Eloquent and Livewire.

Dependencies
------------

[](#dependencies)

- Laravel
- Livewire
- AlpineJS

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

[](#installation)

**Step 1**

Install composer package:

```
composer require kanata-php/forklift
```

**Step 2**

Publish the assets registered in the Service Provider:

```
php artisan vendor:publish --provider="Kanata\Forklift\ForkliftServiceProvider"
```

After this you'll find the assets at the directory `resources/views/vendor/forklift`. At the current version the initial assets are only presentable for projects usign [Tailwind CSS](https://tailwindcss.com/).

**Step 3**

Implement the `Kanata\Forklift\Interfaces\AssetRepositoryInterface` for the component to know how to interact with your project's models. You'll create one per case (e.g. if you need to move nested directories, one repository, then if you need to move documents through directories, another repository).

Methods:

- `AssetRepositoryInterface::changeCurrentLocation` - This method returns current location's "sub locations". This is equivalent to sub folders when you have a folder based structure like a filesystem navigation.
- `AssetRepositoryInterface::moveAsset` - This method executes the movement between locations of the asset being managed.
- `AssetRepositoryInterface::findLocation` - This method finds the current location object.

    > The output must be an array with the following fields:
    >
    >
    > - id (int) - primary key
    > - title (string) - location's title
    > - parent (int) - parent location (for nested locations)

Usage
-----

[](#usage)

### Basics

[](#basics)

Let's assume we have a filesystem structure. In this structure you have documents and directories. This package adds a dropdown that allows quickly moving assets in the directory structure.

For such, using eloquent, we would have the models:

- **Directory** - that keeps the directories structure, having subdirectories and documents inside them.

> Example migration:
>
> ```
> Schema::create('directories', function (Blueprint $table) {
>     $table->id();
>     $table->string('title', 40);
>     $table->foreignId('parent')->nullable();
>     $table->timestamps();
> });
> ```

- **Document** - that keeps the documents.

> Example migration:
>
> ```
> Schema::create('documents', function (Blueprint $table) {
>     $table->id();
>     $table->string('title', 40);
>     $table->longText('content');
>     $table->foreignId('directory_id')->nullable();
>     $table->timestamps();
> });
> ```

The following component is the **dropdown** to move documents:

```
@livewire('forklift-dropdown', [
    'currentLocationId' => $document->directory_id,
    'locationType' => \App\Models\Directory::class,
    'assetId' => $document->id,
    'assetType' => \App\Models\Document::class,
    'assetRepository' => App\Repositories\DocumentAssetRepository::class,
    'parentField' => 'directory_id',
])
```

The following component is the dropdown to move directories:

```
@livewire('forklift-dropdown', [
    'currentLocationId' => $directory->parent,
    'locationType' => \App\Models\Directory::class,
    'assetId' => $directory->id,
    'assetType' => \App\Models\Directory::class,
    'assetRepository' => App\Repositories\DirecotryAssetRepository::class,
    'parentField' => 'parent',
])
```

You can find an example laravel project [here](https://github.com/kanata-php/forklift-example).

### Events

[](#events)

Forklift dispatches 2 events, in 3 different levels. The 2 events are:

- `Kanata\Forklift\Events\AssetMoved` - Triggered after a successful return from the asset repository.
- `Kanata\Forklift\Events\AssetMoveFailed` - Triggered after a fail return from th asset repository.

The 3 levels that these events are dispatched are:

- Laravel Events ()
- Livewire Events ()
- Browser events via Livewire ()

Todo
----

[](#todo)

- Change UI when backend error happens.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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 ~11 days

Total

5

Last Release

1299d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/90c2bdf7a2fb985ab0c72c842c4f7cbff79cb172deb85c06edf0bedceb3c9498?d=identicon)[lotharthesavior](/maintainers/lotharthesavior)

---

Top Contributors

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

---

Tags

laravelfilelivewiredirectoryfolder

### Embed Badge

![Health badge](/badges/kanata-php-forklift/health.svg)

```
[![Health](https://phpackages.com/badges/kanata-php-forklift/health.svg)](https://phpackages.com/packages/kanata-php-forklift)
```

###  Alternatives

[spatie/livewire-filepond

Upload files using Filepond in Livewire components

306452.7k3](/packages/spatie-livewire-filepond)[tomatophp/filament-browser

File &amp; Folders &amp; Media Browser With Code Editor

407.6k2](/packages/tomatophp-filament-browser)[itskodinger/midia

Simple Media manager for your Laravel project

1415.8k](/packages/itskodinger-midia)[icecave/temptation

Painless temporary files and directories that clean up after themselves.

129.3k2](/packages/icecave-temptation)

PHPackages © 2026

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