PHPackages                             amirsahra/illustrator - 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. amirsahra/illustrator

ActiveLibrary

amirsahra/illustrator
=====================

Easy management of image addition and update

v1.0.2(3y ago)211MITPHP

Since Jan 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/amirsahra/illustrator)[ Packagist](https://packagist.org/packages/amirsahra/illustrator)[ RSS](/packages/amirsahra-illustrator/feed)WikiDiscussions dev Synced 1mo ago

READMEChangelog (2)DependenciesVersions (4)Used By (0)

[![](https://camo.githubusercontent.com/1393873acad059156e1977aabe757b7d9f2a751c9949e5ffeba3fff19b37cdef/68747470733a2f2f7777772e64657369676e626f6d62732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032312f30382f626573742d70686f746f2d73746f726167652d617070732d73697465732e706e67)](https://camo.githubusercontent.com/1393873acad059156e1977aabe757b7d9f2a751c9949e5ffeba3fff19b37cdef/68747470733a2f2f7777772e64657369676e626f6d62732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032312f30382f626573742d70686f746f2d73746f726167652d617070732d73697465732e706e67)

illustrator
===========

[](#illustrator)

[![License](https://camo.githubusercontent.com/dbe070fb5ad2b4d81a02a78edda8a7e93bad696652ca1d12638bd8311b1afeb8/68747470733a2f2f706f7365722e707567782e6f72672f73696c6265722f626f756e6365722f6c6963656e73652e737667)](https://github.com/JosephSilber/bouncer/blob/master/LICENSE.txt)

Introduction
------------

[](#introduction)

Easy management of image addition and update

My most important concerns in working with images have been naming and determining where to store them. That's why I decided to develop this package so that any programmer who, like me, is tired of this naming and choosing the directory to save images, can use it and upload an image to the desired directory without additional work.

It also has the ability to update the target image, which means the target image is deleted and the new image is saved. so easily.

After installation, you can easily use illustrator only with the help of corrupting its facade.

```
// Upload the image with the default values set in the config file of this package
Illustrator::upload($request->imageFieldName);

// Upload the image to the desired directory
Illustrator::setDir('images/users')->upload($request->imageFieldName);

// Upload the image to the desired name
Illustrator::setName('myDesiredName')->upload($request->imageFieldName);

// Upload the image to the desired disk
Illustrator::setDisk('public')->upload($request->imageFieldName);

//You can use this method together, but the upload method must be at the end.
Illustrator::setDisk('public')
    ->setName('myDesiredName')
    ->setDir('images/users')
    ->upload($request->imageFieldName);
```

Updating images is also very simple as above, and instead of the upload method, we use update with the parameter of the complete directory of the image that we want to update.

```
Illustrator::setDisk('public')
    ->setName('myDesiredName')
    ->setDir('images/users')
    ->update($request->imageFieldName,$imagePath);
```

### Disks

[](#disks)

According to the capabilities of Laravel, we have two types of storage disks. `public` and `local` If we want to access an image with a URL (such as a user's image, banner, etc.), its disk must be `public`, and if we want an image that can only be downloaded securely (such as invoices, transaction lists, and any image that security is) its disk must be `local`.

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

[](#installation)

- You can install the package using composer:

```
composer require amirsahra/illustrator
```

- Add the following class to the providers array in `config/app.php`

```
Amirsahra\Illustrator\IllustratorServiceProvider::class,
```

- You need to add the config file to the config directory. Publish the configuration file:

```
php artisan vendor:publish --tag="illustrator"
```

### WARNING

[](#warning)

If this command did not publish any files, chances are, the Laratrust service provider hasn't been registered. Try clearing your configuration cache.

```
php artisan config:clear
```

And

```
composer dump-autoload
```

### The Public Disk

[](#the-public-disk)

To use the `public` disk according to the Laravel feature, you need to create a link.

To create the symbolic link, you may use the storage:link Artisan command:

```
php artisan storage:link
```

Usage
-----

[](#usage)

For example, you have a model name MyImage with these fields

```
  id,
  path,
  created_at,
  updated_at
```

- ### configs

    [](#configs)

In the configuration file, the activation of the options and their default values are determined.

Let's start by config You edit the config file related to the package that is located in the config directory named illustrator with the publish command (which is explained in the installation section).

This is the default value, and if needed,

keyvalue (default)Description`disk``public`You can choose the disk you want.
This is the default value, and if needed,
you can choose the desired disk when saving the image.
Supported Drivers: "local", "public"`image_path.dir``illustrator/imgs`Default directory to save images`image_path.random_string.length``10`If you want the name of the image to be created by default and include a random string, set this feature to active and set the string length.`image_path.random_string.is_active``true`You can enable and disable this feature.`image_path.prefix.value``pre`If you want the name of the image to be created by default and include a prefix, set this feature to active and set the prefix value.`image_path.prefix.is_active``true`You can enable and disable this feature.`image_path.postfix.value``po`If you want the name of the image to be created by default and include a postfix, set this feature to active and set the postfix value.`image_path.postfix.is_active``true`You can enable and disable this feature.- ### Facade

    [](#facade)

You will easily access it with the help of Facade Package. Just use it in the use class.

```
use Amirsahra\Illustrator\Facade\Illustrator;

Illustrator::upload($request->imageFieldName);
```

- ### Upload

    [](#upload)

This method alone is enough to upload the image. Other values, including directory, name, prefix, and extension, if enabled, are taken from the default value set in the configuration.

The input parameter of the method is of type UploadedFile and it is taken from the sent request that contains the image.

The return of this method is the full address of the image that you use to access the image. Note that the return of this method is saved as the address of the image in the database.

Consider this example :

In form

```

        Choose file to upload

        Submit

```

In class or controller method

```
namespace App\Http\Controllers;

use Amirsahra\Illustrator\Facade\Illustrator;
use App\MyImage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;

class HomeController extends Controller
{
    public function uploadImage(Request $request)
    {
        $imgPath = Illustrator::upload($request->imageInput);
        MyImage::create([
            'path' => $imgPath
        ]);

        return Redirect::back()->with(['msg' => 'successfully']);
    }
}
```

- ### Directory

    [](#directory)

You can enter your directory. If you want to use the default directory you specified in the config file, you don't need to use this method.

```
namespace App\Http\Controllers;

use Amirsahra\Illustrator\Facade\Illustrator;
use App\MyImage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;

class HomeController extends Controller
{
    public function uploadImage(Request $request)
    {
        $imgPath = Illustrator::setDir('myDirectory/images')->upload($request->imageInput);
        MyImage::create([
            'path' => $imgPath
        ]);

        return Redirect::back()->with(['msg' => 'successfully']);
    }
}
```

- ### Name

    [](#name)

Specify the name of the image or by default it will create a random string with the length you specified in the config file.

Note: The name of the image must be without its type and its type is taken from the image file itself, for example, the name `imageName.png` is incorrect

```
namespace App\Http\Controllers;

use Amirsahra\Illustrator\Facade\Illustrator;
use App\MyImage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;

class HomeController extends Controller
{
    public function uploadImage(Request $request)
    {
        $imgPath = Illustrator::setName('imageName')->upload($request->imageInput);
        MyImage::create([
            'path' => $imgPath
        ]);

        return Redirect::back()->with(['msg' => 'successfully']);
    }
}
```

- ### Disk

    [](#disk)

You have two modes for the disk: public and local

If you want to access an image with its address, you must select the disk as public.

If you want the image to be protected and only downloadable, select local disk.

```
namespace App\Http\Controllers;

use Amirsahra\Illustrator\Facade\Illustrator;
use App\MyImage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;

class HomeController extends Controller
{
    public function uploadImage(Request $request)
    {
        $imgPath = Illustrator::setDisk('public')->upload($request->imageInput);
        MyImage::create([
            'path' => $imgPath
        ]);

        return Redirect::back()->with(['msg' => 'successfully']);
    }
}
```

### Imag access

[](#imag-access)

With the address of the image (which is created when uploading) and the type of disk, the image can be accessed correctly.

If we want the image to be shown on the pages, its disk must be public, and by adding `storage/` to the first of that address, the image will be displayed, as in the following example:

```

```

If we want the image to be protected and can only be downloaded, select its local disk.

To protected access the image at the address that the disk was local to when it was saved:

```
Storage::disk('local')->download('myDirectory/images/imageName.png');
```

- ### Combination of methods

    [](#combination-of-methods)

All methods can be used together, but the upload method must come last

```
namespace App\Http\Controllers;

use Amirsahra\Illustrator\Facade\Illustrator;
use App\MyImage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;

class HomeController extends Controller
{
    public function uploadImage(Request $request)
    {
        $imgPath = Illustrator::setName('imageName')
            setDir('myDirectory/images')
            setDisk('public')
            ->upload($request->imageInput);

        MyImage::create([
            'path' => $imgPath
        ]);

        return Redirect::back()->with(['msg' => 'successfully']);
    }
}
```

- ### Upload

    [](#upload-1)

Updating the images is very simple as above and instead of the upload method, you should use the update with the full directory parameter of the image you want to update.

In this way, the current image is deleted and the new image replaces it namespace App\\Http\\Controllers;

```
use Amirsahra\Illustrator\Facade\Illustrator;
use App\MyImage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;

class HomeController extends Controller
{
public function updateImage(Request $request,MyImage $myImage)
{
    $newImgPath = Illustrator::setName('imageName')
        setDir('myDirectory/images')
        setDisk('public')
        ->update($request->imageInput,$myImage->path);

        $myImage->update([
            'path' => $newImgPath
        ]);

        return Redirect::back()->with(['msg' => 'update image successfully']);
    }
}
```

License
=======

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

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

Total

2

Last Release

1179d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f79a9f6c82d9d40bbdd6796bd2c2475fe04f041cad6dc6c7de9649c71a0d998?d=identicon)[amirsahra](/maintainers/amirsahra)

---

Top Contributors

[![amirsahra](https://avatars.githubusercontent.com/u/19200842?v=4)](https://github.com/amirsahra "amirsahra (20 commits)")

---

Tags

illustratorlaravellaravel-filelaravel-imagelaravel-image-optimizelaravel-image-uploadlaravel-packagelaravel-upload

### Embed Badge

![Health badge](/badges/amirsahra-illustrator/health.svg)

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

PHPackages © 2026

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