PHPackages                             wielski/laravel-storager - 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. wielski/laravel-storager

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

wielski/laravel-storager
========================

Laravel Storager

32PHP

Since Dec 26Pushed 10y ago2 watchersCompare

[ Source](https://github.com/wielski/laravel-storager)[ Packagist](https://packagist.org/packages/wielski/laravel-storager)[ RSS](/packages/wielski-laravel-storager/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel File API
================

[](#laravel-file-api)

Features
--------

[](#features)

- Handle files with Laravel Storage.
- Load files through Laravel routing instead of public path.
- Save images with thumbs, sizes are customisable.

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

[](#installation)

1. Install File API

    ```
    composer require wielski/laravel-fileapi
    ```
2. Set service provider in `config/app.php`

    ```
    Wielski\FileApi\FileApiServiceProvider::class,
    ```
3. publish config file

    ```
    php artisan vendor:publish --tag=fileapi_config
    ```

Config
------

[](#config)

in `config/fileapi.php`

1. fill in the storage path, which make routes for you.

    ```
    'path' => ['/images/event/', '/images/article/'],
    ```

    it will generate routes like below :

    ```
    Route::get('/images/event/{filename}', function ($filename) {
        $entry = new \Wielski\FileApi\FileApi('/images/event/');
        return $entry->getResponse($filename);
    });

    Route::get('/images/article/{filename}', function ($filename) {
        $entry = new \Wielski\FileApi\FileApi('/images/article/');
        return $entry->getResponse($filename);
    });
    ```
2. set default thumb sizes(by key and value)

    ```
    'default_thumbs' => ['S' => '96x96', 'M' => '256x256', 'L' => '480x480'],
    ```

Usage
-----

[](#usage)

### Initialize File API

[](#initialize-file-api)

```
use \Wielski\FileApi\FileApi;

$fa = new FileApi(); # use default path (as '/images/')
$fa_event = new FileApi('/images/event/'); # initialize it by giving a base path
$fa_article = new FileApi('/images/article/'); # initiate another instance
```

### Save By Giving Uploaded File

[](#save-by-giving-uploaded-file)

- Default Usage : get unique filename

    ```
    $file = $fa->save(\Input::file('main_image')); // => wfj412.jpg
    ```
- Custimize your upload file name

    ```
    $file = $fa->save(\Input::file('main_image'), 'custom-file-name'); // => custom-file-name.jpg
    ```
- By default will set three thumbs(equal scaling)

### Thumbnail functions

[](#thumbnail-functions)

- Set custom thumb sizes

    ```
    $file = $fa
        ->thumbs([
        	'S' => '150x100',
        	'M' => '300x200',
        	'L' => '450x300'
        	])
        ->save(\Input::file('main_image'));
    ```
- make cropped thumbs

    ```
     $file = $fa->crop()->save(\Input::file('main_image'));
    ```

### Get image url

[](#get-image-url)

```
$fa->get('wfj412.jpg');        // => get image url of 'L' size
$fa->get('wfj412.jpg', 'M');   // => get image url of 'M' size
$fa->get('wfj412.jpg', 'full); // => get image url of full size
```

### Delete image and thumbs

[](#delete-image-and-thumbs)

```
$fa->drop('wfj412.jpg');
```

### Get file fullpath (abstract path from Laravel Storage)

[](#get-file-fullpath-abstract-path-from-laravel-storage)

```
$fa->getPath('wfj412.jpg'); // => '/images/event/wfj412.jpg'
```

### Parse File Path to URL

[](#parse-file-path-to-url)

if you store your file into cloud storage and you want to get url cloud site, you can use url() method to get it

```
echo $fa->getUrl('wfjsdf.jpg'); // => "https://s3-ap-northeast-1.amazonaws.com/xxx/xxx/55c1e027caa62L.png"
```

### Work with Blade

[](#work-with-blade)

In your app.php add alias for FileApi class

```
'FileApi'   => Wielski\FileApi\FileApi::class,

```

Using in Blade:

```
{{ FileApi::getFile('/images/avatars/', 'image.jpg', 'S') ?: 'default.jpg' }}

```

### Work with Laravel Storage

[](#work-with-laravel-storage)

- Get file content

    ```
    \Storage::get($fa->getPath('wfj412.jpg'));
    ```
- Write files

    ```
    \Storage::put($fa->getPath('wfj412.jpg'));
    ```
- Get Mime Type

    ```
    \Storage::mimeType($fa->getPath('wfj412.jpg'));
    ```

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6212124?v=4)[Andrzej Wielski](/maintainers/wielski)[@wielski](https://github.com/wielski)

---

Top Contributors

[![wielski](https://avatars.githubusercontent.com/u/6212124?v=4)](https://github.com/wielski "wielski (3 commits)")

### Embed Badge

![Health badge](/badges/wielski-laravel-storager/health.svg)

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

PHPackages © 2026

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