PHPackages                             sirmekus/igwe - 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. sirmekus/igwe

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

sirmekus/igwe
=============

A PHP package for handling file uploads

1.2.4(2y ago)117MITPHPPHP &gt;=5.4.0

Since Dec 31Pushed 2y ago1 watchersCompare

[ Source](https://github.com/SirMekus/igwe)[ Packagist](https://packagist.org/packages/sirmekus/igwe)[ RSS](/packages/sirmekus-igwe/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (9)Used By (0)

Igwe
====

[](#igwe)

Igwe is a PHP file uploader with validation support to add power to an exisitng web app. One of the additional benefits include enforcing (or constraining) image dimension. For instance, imagine your application expects image dimension to be 300/300px (height/width) and a user uploads an image with a dimension of 500/200px. Strictly constraining the dimension (using traditional approach) may result in low quality and a not-too-nice image. This library takes care of this effectively without sacrificing quality of the uploaded image.

> Please note that this package is not limited to image upload; It takes care of any type of file upload in general - pdf, doc, audio, video, image, etc, as you will learn shortly.

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

[](#installation)

To get started all you need to do is:

```
composer require sirmekus/igwe
```

> Please note that this package stores uploaded files/images relative to your web root.

That's all.

> Igwe, in Igbo language, means **"King/Chief"**.

---

After installing the package you should then create an `igwe.php` configuration file and place it in your root directory or your **config** directory. This file will contain "directives" on how to configure the package for your service. You can just copy and paste the content below into your own `igwe.php` file for starters (remember that you can always configure the settings):

```
return [
      //relative to the root directory
      'directory'=>'uploads',

      //The height resolution for your image file
      'height'=>1280,

      //The width resolution for your image file
      'width'=>1280,

      //Allowed mime types users can upload
      'mime_type'=>[
            "image/jpeg",
            "image/png",
            "image/gif",
            "image/webp",
            //"application/pdf",
            //"video/mp4"
      ],

      //Maximum file size (in bytes) that is accepted in your application
      'max_size'=>5000000,//5mb

      //Maximum no. of files user(s) can upload at once. If you expect multiple files to uploade (like a gallery upload) then you can increase this value
      'max_to_upload'=>1,//

      //Files will be stored in the /uploads/sub_folder directory. If you have a subdirectory where you group your files then you should put it here. If null then uploaded files will be saved directly in the 'uploads' directory
      'sub_folder'=>null,

      //This will be prepended to every new name generated for each file
      'prefix'=>'uploads',

      //Where errors will be logged. Should be relative to the web root too. If it doesn't exist please create it if you want logging enabled
      'log_path'=>null,
]
```

Please note that if you don't create the file the package will use its default settings. The default settings are the values in the array above.

---

Usage
-----

[](#usage)

---

Receiving/Accepting file/image from client
------------------------------------------

[](#receivingaccepting-fileimage-from-client)

Example:

```
require_once 'vendor/autoload.php';

use App\Igwe\Uploader;

$image = (new Uploader)->upload('image');
```

Just that single line of code is what is needed to use this package. The package assumes the name (parameter) of the incoming file from the client is `image`. If it isn't then you can specify the name as the first argument. Example:

```

```

It doesn't matter if the file is an array or a single file, the package takes care of that, stores the uploaded file in disk and returns the new file name. If an array was detected the returned value will be an array containing the uploaded file names else a string that contains the file which you will want to save in the database.

You can set the configuration during runtime (if you choose to not use the configuration settings at any point in time) or overwrite the public properties of the class. The properties are:

- `docParentFolder` : This is typically the public directory relative to the root folder.
- `sub_folder` : In the `docParentFolder` folder if there is another folder there where you'll like the image to be uploaded you can specify it here. You can specify it as like a file path (`subfolder/path/folder`) or just a single entry like (`subfolder_name`).
- `width` : The allowed width for this image.
- `height` : The allowed height for this image.
- `valid_mimes` : The allowed mime types for this image (should be an array).
- `max_file_upload_size` : The max allowed size for this image in bytes.
- `max_no_of_file_to_upload` : The maximum number of file that can be uploaded for this image. This is useful if your users can upload multiple images.
- `name_of_file` : If specified, instead of randomly generated names this particular name will be used to rename the file. Be careful when setting this cause in a case of multiple file upload the files may be overwritten.

By default the `upload()` method checks if the specified key exists in the incoming request and is filled. If it is not it throws an error. In certain cases image upload may be optional, thus the application should still continue with the request processing. To enable this the method takes a second argument that suppresses the error. Example

```
require_once 'vendor/autoload.php';

use App\Igwe\Uploader;

$image = (new Uploader)->upload('image', true);
```

or, if you use use PHP 8.0 and above and the parameter name from the request is `image`.

```
require_once 'vendor/autoload.php';

use App\Igwe\Uploader;

$image = (new Uploader)->upload(ignore:true);
```

Deleting Image/File
-------------------

[](#deleting-imagefile)

To delete an image it follows the same logic and configuration as if uploading the image/file. Simply pass the image/file name(s) - string or array - to the `remove()` method and the job is done. Example:

```
require_once 'vendor/autoload.php';

use App\Igwe\Uploader;

$image = (new Uploader)->remove($image);
```

Meanwhile
---------

[](#meanwhile)

You can connect with me on [LinkedIn](https://www.linkedin.com/in/sirmekus) for insightful tips and so we can grow our networks together.

Check our educational platform for High Schools [i-runs](https://www.i-runs.com).

And follow me on [Twitter](https://www.twitter.com/Sire_Mekus).

I encourage contribution even if it's in the documentation. Thank you, and I really hope you find this package helpful.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

Recently: every ~61 days

Total

8

Last Release

989d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/28a362d4564e674503260a2ed783e522418dcf6484eeb91616e4624c77a775f9?d=identicon)[sirmekus](/maintainers/sirmekus)

---

Top Contributors

[![webloit-dev](https://avatars.githubusercontent.com/u/66807744?v=4)](https://github.com/webloit-dev "webloit-dev (10 commits)")

---

Tags

file-uploadfile-validationphp

### Embed Badge

![Health badge](/badges/sirmekus-igwe/health.svg)

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

###  Alternatives

[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.3M74](/packages/unisharp-laravel-filemanager)[barryvdh/elfinder-flysystem-driver

A Flysystem Driver for elFinder

1864.7M31](/packages/barryvdh-elfinder-flysystem-driver)[itskodinger/midia

Simple Media manager for your Laravel project

1415.8k](/packages/itskodinger-midia)[jeremytubbs/deepzoom

Deepzoom Tile Generator for OpenSeadragon

5018.7k2](/packages/jeremytubbs-deepzoom)[farhanshares/laravel-mediaman

MediaMan - The most elegant &amp; powerful media management package for Laravel!

293.7k](/packages/farhanshares-laravel-mediaman)[xefi/faker-php-images

Faker extension to generate images

402.6k](/packages/xefi-faker-php-images)

PHPackages © 2026

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