PHPackages                             michele-angioni/support - 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. [Caching](/categories/caching)
4. /
5. michele-angioni/support

ActiveLibrary[Caching](/categories/caching)

michele-angioni/support
=======================

Support is a Laravel package which promotes the use of best practices and design patterns.

v4.0.1(7y ago)181.4k11MITPHPPHP &gt;=7.1.3 &lt;8.0.0

Since Jan 8Pushed 7y ago1 watchersCompare

[ Source](https://github.com/micheleangioni/support)[ Packagist](https://packagist.org/packages/michele-angioni/support)[ RSS](/packages/michele-angioni-support/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (34)Used By (1)

SUPPORT
=======

[](#support)

[![License](https://camo.githubusercontent.com/9643ebc0cedf28a7f2579d2dccda750b06a529a73160470676ec224c109c7fc5/68747470733a2f2f706f7365722e707567782e6f72672f6d696368656c652d616e67696f6e692f737570706f72742f6c6963656e73652e737667)](https://packagist.org/packages/michele-angioni/support)[![Latest Stable Version](https://camo.githubusercontent.com/f8fc15c40edc11ad3d6bd2f39284fd829610d72dc4ab7874397df11063c83199/68747470733a2f2f706f7365722e707567782e6f72672f6d696368656c652d616e67696f6e692f737570706f72742f762f737461626c65)](https://packagist.org/packages/michele-angioni/support)[![Build Status](https://camo.githubusercontent.com/503eaded40dcad4c074e514c8bcc1fe60d0f94345e5ec48b296c2a2011e0e06d/68747470733a2f2f7472617669732d63692e6f72672f6d696368656c65616e67696f6e692f737570706f72742e737667)](https://travis-ci.org/micheleangioni/support)[![SensioLabsInsight](https://camo.githubusercontent.com/81893ee7b8908edaf4001f146981c621ea09e9ef308b31ee0e34004b8bd65fc3/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f38616631346234342d636638322d343032382d386138392d3433386663623133336261362f736d616c6c2e706e67)](https://insight.sensiolabs.com/projects/8af14b44-cf82-4028-8a89-438fcb133ba6)

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

[](#introduction)

Support consists of a series of useful classes to ease development and the use of best practices and design patterns with [Laravel 5](http://laravel.com).

Part of this package has been highly inspired by the [culttt.com](http://culttt.com/) blog, which I highly recommend to both new and experienced developers since it focuses on a wide range of topics with always interesting point of views and discussions. I have personally learned much from it.

Support requires PHP 7.1.3+ and several 5.8 Illuminate components in order to work.

In order to use Support with Laravel or Lumen 5.4 - 5.7, [check version 3.x](https://github.com/micheleangioni/support/tree/3.x/).

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

[](#installation)

Support can be installed through Composer, just include `"michele-angioni/support": "^4.0"` to your composer.json and run `composer update` or `composer install`.

Then add the Support Service Provider in the Laravel `app.php` config file, under the providers array

```
MicheleAngioni\Support\SupportServiceProvider::class
```

and the Helpers facade in the aliases array

```
'Helpers' => MicheleAngioni\Support\Facades\Helpers::class
```

#### Laravel 5.4 - 5.7

[](#laravel-54---57)

If you are looking for the Laravel 5.3 - 5.7 compatible version, check the [3.x branch](https://github.com/micheleangioni/support/tree/3.x) and its documentation.

#### Laravel 5.0 - 5.3

[](#laravel-50---53)

If you are looking for the Laravel 5.0 - 5.3 compatible version, check the [2.x branch](https://github.com/micheleangioni/support/tree/2.x) and its documentation.

#### Laravel 4

[](#laravel-4)

If you are looking for the Laravel 4 version, check the [1.0 branch](https://github.com/micheleangioni/support/tree/1.0) and its documentation.

#### Lumen

[](#lumen)

At the moment, only partial and **unstable** support for Lumen is guaranteed.

First of all load the Service Provider in your bootstrap file

```
$app->register('MicheleAngioni\Support\SupportServiceProvider');
```

and set the needed config key

```
config(['ma_support.cache_time' => 10]); // Default number of minutes the repositories will be cached
```

Modules summary
---------------

[](#modules-summary)

Support comes bundled of the following features: Repositories, Cache, Presenters, Semaphores, an Helpers class and new custom validators. In addition Support provides several new custom exceptions.

Configuration
-------------

[](#configuration)

Support does not need any configuration to work. However, you may publish the configuration file through the artisan command `php artisan vendor:publish` that will add the `ma_support.php` file in your config directory.
You can then edit this file to customize Support behaviour.

In order to access to the file keys in your code, you can use `config('ma_support.key')`, where key is one of the file keys.

Repositories Usage
------------------

[](#repositories-usage)

The abstract class `AbstractEloquentRepository` consists of a model wrapper with numerous useful queries to be performed over the Laravel models. This way implementing the repository pattern becomes straightforward.

As an example let's take a `Post` model. First of all we shall create a common Repository Interface for all models of our application that extends the package `RepositoryInterface`

```
