PHPackages                             atriatech/media - 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. atriatech/media

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

atriatech/media
===============

Explore, Upload, Delete and Create new folder in your laravel project

2.1.7(4y ago)43603[8 issues](https://github.com/atriatech/media/issues)[8 PRs](https://github.com/atriatech/media/pulls)MITPHP

Since May 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/atriatech/media)[ Packagist](https://packagist.org/packages/atriatech/media)[ RSS](/packages/atriatech-media/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (10)Dependencies (2)Versions (94)Used By (0)

[![Media - Explore, Upload, Delete and Create new folder](https://raw.githubusercontent.com/atriatech/media/master/screenshot.png)](https://raw.githubusercontent.com/atriatech/media/master/screenshot.png)

Media - Explore, Upload, Delete and Create new folder
=====================================================

[](#media---explore-upload-delete-and-create-new-folder)

You can use this package to upload your media and attach the media to your models.

VersionLaravel^1.0.0^6.0.0^2.0.0^8.0.0Installation
============

[](#installation)

1. `composer require atriatech/media`.
2. add `Atriatech\Media\MediaServiceProvider::class` to `providers` array inside `config/app.php`.
3. add `'AtriatechMedia' => Atriatech\Media\Facades\AtriatechMedia::class` to `aliases` array inside `config/app.php`.
4. add `"Atriatech\\Media\\": "vendor/atriatech/media/src/"` to `autoload => psr-4` object inside `composer.json` file, then run this command: `composer dump-autoload`.
5. If you haven't link your storage, please run this command `php artisan storage:link`.
6. run `php artisan vendor:publish --tag=atriatech-media-config` to copy the config file into `config` folder.
7. run `php artisan vendor:publish --tag=atriatech-media-public` to copy asset files into `public` folder, running this command with `--force` flag is recommended.
8. run `php artisan vendor:publish --tag=atriatech-media-migrations` to copy the migrations into `database/migrations` folder.
9. run `php artisan migrate` to create the tables.

API
===

[](#api)

You can use these methods on your model:

MethodParametersDescriptionExampleaddMedia$paths - (Single-Array)Add media to your model`User::findOrFail(1)->addMedia([$request->input('image')])`updateMedia$paths - (Array)Update media for your model`User::findOrFail(1)->updateMedia([$request->input('image')])`removeMedia$name - (Single-Array)Remove media from your model`User::findOrFail(1)->removeMedia('image')`getMedia-Return all the media for your model`$media = User::findOrFail(1)->getMedia()`getMediaByName$pattern (String)Return all the media that has a name with the provided pattern`$media = User::findOrFail(1)->getMediaByName('/(extra_images)/')`getMedium$id - (Integer)Get a single medium of your model with an id, If id is empty it will return the first medium`$medium = User::findOrFail(1)->getMedium(2)`getMediumByName$name - (Single-Array)Get a single medium of your model with the name, If the name is empty it will return the first medium`$medium = User::findOrFail(1)->getMediumByName('image')`There is a `getSubSize` method for a single medium which you can get a specific subSize (that you defined in the config file) of an image, using below code:

```
$medium->getSubSize('thumbnail');
```

Usage
=====

[](#usage)

First, take A look at the `atriatech_media.php` file in `config` folder.

Add `AtriatechMedia` to your model

```
use Atriatech\Media\AtriatechMedia;

class Product extends Model
{
    ...
    use AtriatechMedia;
    ...
}
```

In your view you have to load the css and js files and load the media selector:

### Example:

[](#example)

```

    Atriatech Media

    @atriatech_media('css')

    @csrf

    @atriatech_media_start
        @atriatech_media_file('img', '{"name": "image", "placeholder": "Image", "file": ""}')
    @atriatech_media_end

    Submit

@atriatech_media('js')

```

The `@atriatech_media_file` directive has two parameters:

1. ID - for the media selector
2. OPTIONS - A JSON object with these keys:

```
{
    "name": "(String)", // the key which you can get in $request object when the form submitted
    "placeholder": "(String)", // placeholder for the media selector
    "file": "(String)", // Current media path to show in media selector
    "id": "(Number)" // Current media id
}
```

Upload from controller
----------------------

[](#upload-from-controller)

To upload a file from controller simply use the `AtriatechMedia` facade.

```
use Atriatech\Media\Facades\AtriatechMedia;

class HomeController
{
    function index()
    {
        $file = $request->file('file');
        AtriatechMedia::upload($file, 'path'); // path is optional
    }
}
```

Load with JS
------------

[](#load-with-js)

If you want to load the selector with javascript use the instruction below:

add this inside or outside the media selector blade directives.

```
@atriatech_media_start

@atriatech_media_end

```

then load the selector with this code

```
AtriatechMedia.loadMediaSelectorWithJS('mp3', {name: 'mp3', placeholder: 'MP3', accept: '.mp3'});
```

The parameters of `loadMediaSelectorWithJS` method are exactly like `@atriatech_media_file` directive. It only has a third parameter that get `true` or `false`. you should pass `false` if you want to add that `div` element outside the media selector blade directives.

Integrations
------------

[](#integrations)

### CKEditor

[](#ckeditor)

In your view add a textarea:

```

```

Use media as CKEditor file browser:

```
CKEDITOR.replace( 'editor1', {
    filebrowserBrowseUrl: mediaRoute('atriatech.media.index'),
    filebrowserImageBrowseUrl: mediaRoute('atriatech.media.index') + '?accept={{ config('atriatech_media.mime_types.image/*') }}',
});
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 99.4% 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 ~7 days

Recently: every ~0 days

Total

84

Last Release

1609d ago

Major Versions

1.9.2 → 2.1.22021-07-06

1.9.3 → 2.1.32021-09-05

v1.9.4 → 2.1.42021-12-07

1.9.6 → 2.1.62021-12-21

1.9.7 → v2.x-dev2021-12-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/564c759cb74b2e427f9e43e3c90329a0fef7aa196c8629cd66ceb1e3bc69c6df?d=identicon)[RezaT1994](/maintainers/RezaT1994)

---

Top Contributors

[![RezDev94](https://avatars.githubusercontent.com/u/31609638?v=4)](https://github.com/RezDev94 "RezDev94 (174 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

laravelmediaresize-imageupload-imageimageresizemediauploadmedia-explorer

### Embed Badge

![Health badge](/badges/atriatech-media/health.svg)

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

###  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)[mohorev/yii2-upload-behavior

Upload behavior for Yii 2

128265.5k9](/packages/mohorev-yii2-upload-behavior)[mostafaznv/larupload

Larupload is a ORM based file uploader for laravel to upload image, video, audio and other known files.

73403.7k3](/packages/mostafaznv-larupload)[tilleuls/ckeditor-sonata-media-bundle

Integrates SonataMediaBundle with CKEditor

53531.4k1](/packages/tilleuls-ckeditor-sonata-media-bundle)[yii-dream-team/yii2-upload-behavior

Yii2 file/image upload behavior for ActiveRecord

79207.1k16](/packages/yii-dream-team-yii2-upload-behavior)[contributte/image-storage

Image storage for Nette framework

28749.3k1](/packages/contributte-image-storage)

PHPackages © 2026

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