PHPackages                             feugene/laravel-files - 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. [Image &amp; Media](/categories/media)
4. /
5. feugene/laravel-files

ActiveLibrary[Image &amp; Media](/categories/media)

feugene/laravel-files
=====================

Laravel files model

v1.0.0(7y ago)111PHPPHP &gt;7.1.3

Since Jan 5Pushed 7y ago1 watchersCompare

[ Source](https://github.com/efureev/laravel-files)[ Packagist](https://packagist.org/packages/feugene/laravel-files)[ RSS](/packages/feugene-laravel-files/feed)WikiDiscussions master Synced 2mo ago

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

[![Latest Stable Version](https://camo.githubusercontent.com/324fb42fcbd0bf2d9b9e54dfa6833784c86880be4129da098728e57871db6f46/68747470733a2f2f706f7365722e707567782e6f72672f66657567656e652f6c61726176656c2d66696c65732f762f737461626c65)](https://packagist.org/packages/feugene/laravel-files)[![Total Downloads](https://camo.githubusercontent.com/a0ea70efd3bc0e5d01ecdb608e8c0414db938f19c93170b39035ce57e1389823/68747470733a2f2f706f7365722e707567782e6f72672f66657567656e652f6c61726176656c2d66696c65732f646f776e6c6f616473)](https://packagist.org/packages/feugene/laravel-files)[![Latest Unstable Version](https://camo.githubusercontent.com/408ddcda0aa550892c65af4dea26cce66dd2dbfe22457665e960eed1d76f19e1/68747470733a2f2f706f7365722e707567782e6f72672f66657567656e652f6c61726176656c2d66696c65732f762f756e737461626c65)](https://packagist.org/packages/feugene/laravel-files)

[![Build Status](https://camo.githubusercontent.com/d29d8768d445cc9abb19dddb057cbbb84ae823f525df2d9d97f19bc269ac7b03/68747470733a2f2f7472617669732d63692e6f72672f656675726565762f6c61726176656c2d66696c65732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/efureev/laravel-files)

[![Maintainability](https://camo.githubusercontent.com/7f492b2d3f0a2c6310d304f17f147b3dde5137d52d755bc69a8b53c0cdba9bca/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f36663761653237316465326164396433336363642f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/efureev/laravel-files/maintainability)[![Test Coverage](https://camo.githubusercontent.com/434ab525c3d58b9492a9f2c7c50d5bef256b5332ad50c3d8612235c18be84540/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f36663761653237316465326164396433336363642f746573745f636f766572616765)](https://codeclimate.com/github/efureev/laravel-files/test_coverage)

Information
-----------

[](#information)

Add-on file model for Laravel models. Implements work with native files.

Install
-------

[](#install)

- `composer require feugene/laravel-files`

Examples
--------

[](#examples)

- Add ServiceProvider into your app: `config/app.php` (section: `providers`)

    ```
        // ...
        Feugene\Files\ServiceProvider::class,
    ```

    or if Laravel &gt;= 5.7 - use service discover.
- Run `php artisan migrate` for add table for file

### File upload

[](#file-upload)

Only simple upload:

```
public function store()
{
    $list = app(UploadService::class)
        ->upload();

    return [
        'success' => $list->isNotEmpty(),
        'files'   => $list,
    ];
}
```

Upload with wrapped file to model via after actions:

```
public function store()
{
    $list = app(UploadService::class)
        ->setAfterAction(AfterModelAction::class)
        ->upload();

    return [
        'success' => $list->isNotEmpty(),
        'files'   => $list,
    ];
}
```

Upload with wrapped file to custom model and custom path:

```
public function store(int $sectionId)
{
    /** @var Section $section */
    $section = Section::findOrFail($sectionId);

    $this->authorize('uploadFile', $section);

    $upload = new Upload($section);
    $path = $upload->getUploadPath();

    $list = app(UploadService::class)
        ->setPath($path)
        ->setAction(BeforeBaseAction::class, 'before')
        ->setAfterAction(AfterModelAction::class)
        ->setAfterAction(function ($file) use ($section) {
            /** @var \Feugene\Files\Models\File $file */

            return File::create([
                'section_id' => $section->id,
                'author_id'  => \Auth::id(),
                'name'       => $file->getBaseFile()->getFilename(),
                'file_id'    => $file->getKey()
            ]);
        })
        ->upload();

    return [
        'success' => $list->isNotEmpty(),
        'files'   => $list,
    ];
}
```

### Relations and image operations

[](#relations-and-image-operations)

```
// find image type from DB
/** @var ImageFile $file */
$file = ImageFile::find($id);

// create child relation with clone image
$child = $file->createChild();

// Image scale to 50% from original
// without relation
$child = $file->scale(new ScaleModificator(50));
// create child relation
$child = $file->createChild(new ScaleModificator(50));

// Image resize to 50px by width
// without relation
$child = $file->resize(new ResizeModificator(50));
// create child relation
$child = $file->createChild(new ResizeModificator(50));

// Image resize to 50px by height
// without relation
$child = $file->resize(new ResizeModificator(null, 50));
// create child relation
$child = $file->createChild(new ResizeModificator(null, 50));

// Image resize to 50px by height and 100px by width and bestFit options
// without relation
$child = $file->resize(new ResizeModificator(100, 50));
// create child relation
$child = $file->createChild(new ResizeModificator(100, 50));

// Image resize to 50px by height and 100px by width and important size (100x50)
// without relation
$child = $file->resize(new ResizeModificator(100, 50, false));
$child = $file->resize(new ResizeModificator(100, 50, false), true);  // if original image is smaller than target image
// create child relation
$child = $file->createChild(new ResizeModificator(100, 50, false));
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.5% 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

2681d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/62a6e061d1ccab4d5de8dcba717b7634f91e4842b32ca26420b8261c66104bf7?d=identicon)[efureev](/maintainers/efureev)

---

Top Contributors

[![efureev](https://avatars.githubusercontent.com/u/5524684?v=4)](https://github.com/efureev "efureev (42 commits)")[![tarampampam](https://avatars.githubusercontent.com/u/7326800?v=4)](https://github.com/tarampampam "tarampampam (2 commits)")

---

Tags

fileimagelaravellaravel-packagelaravelfiles

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/feugene-laravel-files/health.svg)

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.6k509.9M17.0k](/packages/laravel-framework)[bavix/laravel-wallet

It's easy to work with a virtual wallet.

1.3k1.1M11](/packages/bavix-laravel-wallet)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k22](/packages/bkwld-croppa)[laravel/nightwatch

The official Laravel Nightwatch package.

3486.1M13](/packages/laravel-nightwatch)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[talvbansal/media-manager

A media browser and uploader for laravel apps written in vue js and bootstrap

20827.7k4](/packages/talvbansal-media-manager)

PHPackages © 2026

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