PHPackages                             bnhashem/file - 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. bnhashem/file

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

bnhashem/file
=============

CRUD File From Any Section

v2.0.3(5y ago)069MITPHP

Since Dec 27Pushed 5y ago1 watchersCompare

[ Source](https://github.com/BNhashem16/files)[ Packagist](https://packagist.org/packages/bnhashem/file)[ RSS](/packages/bnhashem-file/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (6)Used By (0)

File CRUD In One Line
=====================

[](#file-crud-in-one-line)

[![Issues](https://camo.githubusercontent.com/32749ef75528879bc8375ae71de4596ae26e02453c2a08f4893808b58f7d1002/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f424e68617368656d31362f496d616765732e7376673f7374796c653d706c6173746963266c6f676f3d6170707665796f72)](https://github.com/BNhashem16/Images)

[![Forks](https://camo.githubusercontent.com/ce2745f827efc70cb1d69d3be186dcdbedd6954171772813881ec7d59100656e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f424e68617368656d31362f496d616765732e7376673f7374796c653d706c6173746963266c6f676f3d6170707665796f72)](https://github.com/BNhashem16/Images)

[![Stars](https://camo.githubusercontent.com/00656be02ec12de85acc555504d092840af60ee1d46328a59f417ca8f01e4e72/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f424e68617368656d31362f496d616765732e7376673f7374796c653d706c6173746963266c6f676f3d6170707665796f72)](https://github.com/BNhashem16/Images)

[![License](https://camo.githubusercontent.com/6b2eb4d45ffa0053f6e929e9d06c05284521c2c9f805a86360ad7f3f589ff294/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f424e68617368656d31362f496d616765732e7376673f7374796c653d706c6173746963266c6f676f3d6170707665796f72)](https://github.com/BNhashem16/Images)

[![Twitter](https://camo.githubusercontent.com/1faf3aab2e5968887799797c50a9e90f78eaed891ca6ca8564c65c4b562aced1/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c3f75726c3d68747470733a2f2f747769747465722e636f6d2f6465765f68617368656d253246424e68617368656d3136253246496d61676573)](https://twitter.com/dev_hashem)

Installing File Package
-----------------------

[](#installing-file-package)

The recommended way to install File Package is through [Composer](https://getcomposer.org/).

```
composer require bnhashem/file
```

Storage Link
------------

[](#storage-link)

Creating Shourtcut of storage folder , you will found shortcut by following this path `your-project/public`

```
php artisan storage:link
```

Updating your Provider Array
----------------------------

[](#updating-your-provider-array)

you should Go to `config\app.php` , in Provider array you should put this Line:

```
'providers' => [
        /*
         * Laravel Framework Service Providers...
         */
         Bnhashem\File\FileServiceProvider::class,
    ],
```

Store File
----------

[](#store-file)

```
    use Bnhashem\File\Traits\File;

    public function store(Request $request)
    {
        $post = new Post([
            'image'     => File::store('posts' , 'image'),
            'banner'    => File::store('posts' , 'banner'),
        ]);
        $post->save();

        // posts is the parent Folder
        // image and banner are the childs Folders
        // image and banner also request name , that mean image or banner is required.
    }
```

Update File
-----------

[](#update-file)

In update Model function:

- If `$request->image` or `$request->banner` is Equal null , that mean Nothing Will Not happen
- If `$request->image` or `$request->banner` is Not Equal null , that mean image or banner will removed from Database and Server and store New image that will comming From request

```
    use Bnhashem\File\Traits\File;

    public function update(Request $request , Post $post)
    {
        $post->update([
            'image'  = File::update('posts' , 'image' , $post),
            'banner' = File::update('posts' , 'banner' , $post),
        ]);

        // posts are the parent Folder
        // image and banner are the childs Folders
        // image and banner also request name , that mean image or banner is required.
        // You should pass Row to function
    }
```

Destroy File
------------

[](#destroy-file)

In destroy Model function: File will removed From Database and also will Removed from server.

```
    use Bnhashem\File\Traits\File;

    public function destroy(Request $request , Post $post)
    {
        File::destroy('image' , $post);
        File::destroy('banner' , $post);

        // You should pass Row to function
    }
```

How to get file
---------------

[](#how-to-get-file)

For Example if you upload photo , you will find it According to this path :

```

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Total

5

Last Release

1954d ago

Major Versions

v1.0.0 → v2.0.02021-01-01

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/40724217?v=4)[Ahmed Mohamed salah](/maintainers/bnhashem)[@bnhashem](https://github.com/bnhashem)

---

Top Contributors

[![BNhashem16](https://avatars.githubusercontent.com/u/49618985?v=4)](https://github.com/BNhashem16 "BNhashem16 (2 commits)")

### Embed Badge

![Health badge](/badges/bnhashem-file/health.svg)

```
[![Health](https://phpackages.com/badges/bnhashem-file/health.svg)](https://phpackages.com/packages/bnhashem-file)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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