PHPackages                             morrelinko/laravel-simple-photo - 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. [Image &amp; Media](/categories/media)
4. /
5. morrelinko/laravel-simple-photo

AbandonedArchivedLibrary[Image &amp; Media](/categories/media)

morrelinko/laravel-simple-photo
===============================

5322PHP

Since Jun 22Pushed 11y ago1 watchersCompare

[ Source](https://github.com/morrelinko/laravel-simple-photo)[ Packagist](https://packagist.org/packages/morrelinko/laravel-simple-photo)[ RSS](/packages/morrelinko-laravel-simple-photo/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Simple Photo
============

[](#simple-photo)

Simple Photo Wrapper for Laravel 4. Simple photo is a library that simplifies handling of photos in your application.

\##Installation

Add `morrelinko/laravel-simple-photo` to your `composer.json` dependencies:

```
{
  "require": {
    "morrelinko/laravel-simple-photo": "dev-master"
  }
}
```

Afterwards, run `composer update` to update your dependencies or `composer install` to install them.

Add an entry for the service provider by editing `app/config/app.php` config file.

```
	'providers' => array(

		// ...

		'Morrelinko\LaravelSimplePhoto\SimplePhotoServiceProvider',
	);
```

Add an entry in your 'aliases' for the `SimplePhoto` facade

```
    'aliases' => array(

        // ...

        'SimplePhoto' => 'Morrelinko\LaravelSimplePhoto\SimplePhotoFacade'
    );
```

Run `php artisan config:publish morrelinko/laravel-simple-photo` to copy the default config file.

Copy the migration from `vendor/morrelinko/laravel-simple-photo/src/migrations to your migrations directory.

And run `php artisan migrate` to run the migration that will create the 'photos' table.

SimplePhoto
-----------

[](#simplephoto)

```
// ...

$source = new LaravelUploadSource($request->file('photo'));
$photoId = SimplePhoto::upload($source);

$user->photo_id = $photoId;
$user->save();
```

And to retrieve the photo later

```
$user = User::find(1);
$photo = SimplePhoto::get($user->photo_id);

echo $photo->url();
echo $photo->fileSize();
echo $photo->fileExtension();
```

SimplePhoto &amp; Eloquent Models
---------------------------------

[](#simplephoto--eloquent-models)

If you are using php 5.4+, you should use the `SimplePhotoTrait`. 'Makes things easy!!' (o\_o ).

Example:::

```
use Morrelinko\LaravelSimplePhoto\SimplePhotoTrait;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    protected $photos = array(
        'photo' => array('column' => 'photo_id')
    );

    use SimplePhotoTrait;

    public function photo()
    {
        return $this->belongsTo('Morrelinko\LaravelSimplePhoto\Photo', 'photo_id', 'id');
    }
}
```

Of course, what this will do is that it will add a 'photo' property to this model. And whenever you try to get

this property, it will retrieve the photo just the same way as the above example shows.

The value is a set of options which the trait uses to build the photo of which the 'column' is the most important

as it is the field which contains the ID of the photo you wish to retrieve.

Using the Class
---------------

[](#using-the-class)

```
$user = User::find(1);

echo $user->photo->url();
echo $user->photo->fileSize();
echo $user->photo->fileExtension();

// .....
```

Extra
-----

[](#extra)

If your entity has more than one photo, you can specify all of em like so:::

```
use Morrelinko\LaravelSimplePhoto\SimplePhotoTrait;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    protected $photos = array(
        'photo' => array('column' => 'photo_id'),
        'coverPhoto' => array('column' => 'cover_photo_id'),
        'profileBg' => array('column' => 'profile_bg_id')
    );

    use SimplePhotoTrait;

    public function photo()
    {
        return $this->belongsTo('Morrelinko\LaravelSimplePhoto\Photo', 'photo_id', 'id');
    }

    public function coverPhoto()
    {
        return $this->belongsTo('Morrelinko\LaravelSimplePhoto\Photo', 'cover_photo_id', 'id');
    }

    public function profileBg()
    {
        return $this->belongsTo('Morrelinko\LaravelSimplePhoto\Photo', 'profile_bg_id', 'id');
    }
}

$user = User::find(1);
echo $user->photo->url();
echo $user->coverPhoto->url();
echo $user->profileBg->url();
```

Options such as transformations and fallback can be added.

```
use Morrelinko\LaravelSimplePhoto\SimplePhotoTrait;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    protected $photos = array(
        'photo' => array(
            'column' => 'photo_id',
            'fallback' => 'user_not_found.png',
            'transform' => array(
                'resize' => array(100, 100)
                'rotate' => array(180)
            )),
        'coverPhoto' => array(
            'column' => 'cover_photo_id',
            'fallback' => 'cover_default.png'
        ),
    );

    use SimplePhotoTrait;
}

$user = User::find(1);
echo $user->photo->url();
echo $user->coverPhoto->url();
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

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://www.gravatar.com/avatar/a28fa910f21fdbfeab53d5727fad337dc6680a16a7c69677dd89b712f1bfd7f5?d=identicon)[morrelinko](/maintainers/morrelinko)

---

Top Contributors

[![morrelinko](https://avatars.githubusercontent.com/u/2414096?v=4)](https://github.com/morrelinko "morrelinko (14 commits)")

### Embed Badge

![Health badge](/badges/morrelinko-laravel-simple-photo/health.svg)

```
[![Health](https://phpackages.com/badges/morrelinko-laravel-simple-photo/health.svg)](https://phpackages.com/packages/morrelinko-laravel-simple-photo)
```

###  Alternatives

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)[humanmade/tachyon-plugin

Rewrites WordPress image URLs to use Tachyon

87338.5k2](/packages/humanmade-tachyon-plugin)

PHPackages © 2026

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