PHPackages                             red-code/master-package - 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. red-code/master-package

ActiveLibrary

red-code/master-package
=======================

master package

314PHP

Since Mar 18Pushed 4y ago1 watchersCompare

[ Source](https://github.com/red-code-mp/MP-Master)[ Packagist](https://packagist.org/packages/red-code/master-package)[ RSS](/packages/red-code-master-package/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

### Introduction

[](#introduction)

Time of development is developers' main concern, which they always try to decrease when involved in any project. So, this package helps them finish their takes fast and easily by using time-shortening pre-defined method having the ability to end all service processes in the blink of an eye.
As we know, Design patterns represent the best practice that the developers use to solve the general problems that they face during software development, so in this library, we use a Repository pattern to implement all API functionality whether they were simple CRUD or even complex ones

### Installation

[](#installation)

```
$ composer require red-code/master-package
```

copy service provider link to config/app.php , providers\[\]

```
MP\Base\MasterPackageServiceProvider::class
```

then you should publish library's config file by typing the following command

```
$ php artisan vendor:publish --provider=MP\Base\MasterPackageServiceProvider
```

### Request Flow

[](#request-flow)

Route -&gt; Controller -&gt; Request -&gt; Controller's method -&gt; Repository's method -&gt; Resource -&gt; Back to controller's method

### How to use

[](#how-to-use)

You should follow the following instruction to take the advantages that the library supports

#### Controller

[](#controller)

After creating your own controller, you should inherit library's controller

```
class Controller extends \MP\Base\Http\Controllers\Controller
{
    protected $request = {RequestClass}::class;
    protected $repository = {RepositoryClass}::class;
}
```

After validating request's data, Controller moves the request to Repository's method which it does have the same name of called controller's method to perform the intended actions.

For CURD operations, you won't need to create any methods in Repository class 'cause they are already implemented in the Parent repository, otherwise you should create method with the same name of the called controller's method.

#### Request

[](#request)

```
 class Request extends \MP\Base\Http\Requests\Request
 {
 }
```

#### Repository

[](#repository)

```
class Repository extends \MP\Base\Repositories\Repository
{
    protected $model = {ModelClass}::class;
    protected $resource = {ResourceClass}::class;
}
```

Repository class calls Resource `serializeFor{repository'sMethod}` method automatically, if you are working on the simple CRUD methods, otherwise you should use

```
$this->collection($data, $isList = false, $name = null)
```

to call the resource's method, so you can customize the returned data easily

##### Notes:

[](#notes)

- You can call any method from Resource even if that method does not have `serializeFor{repository'sMethod}` name by passing its name as a third parameter of collection method.
- Guess what, you can customize the data attribute of Pagination Object easily without any further complexity, by passing PaginationObject to the collection method and mark it as a list by passing true value to the second parameter of the same collection method

#### Resource

[](#resource)

```
class Resource extends \MP\Base\Http\Resources\Resource
{
}
```

Resource object returns the result of `toArray($request)` for all undefined called method, otherwise it returns the result of defined called methods

### Recommendation

[](#recommendation)

We recommend you to use [LModular](https://github.com/PShadowClone/LModular) if you want to get the benefits of the auto dependency injection which is the way that the library use to detect **Resource**, **Repository**, **Request**, and **Model** automatically by creating the package with the same structure that the [LModular](https://github.com/PShadowClone/LModular) does, and naming all previous classes with the same name of the **Model** class.

### Contact

[](#contact)

- [Amr Saidam](mailto:amr.saidam.94@gmail.com)
- [Khalid Sabbah](mailto:khalidsami.se@gmail.com)

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 Bus Factor1

Top contributor holds 92.9% 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/e8ea039bac10f8895fac122ba9f00e2328e622996317fe448783bb37458bcd2a?d=identicon)[redcode94](/maintainers/redcode94)

---

Top Contributors

[![red-code-mp](https://avatars.githubusercontent.com/u/100975013?v=4)](https://github.com/red-code-mp "red-code-mp (13 commits)")[![PShadowClone](https://avatars.githubusercontent.com/u/25161176?v=4)](https://github.com/PShadowClone "PShadowClone (1 commits)")

### Embed Badge

![Health badge](/badges/red-code-master-package/health.svg)

```
[![Health](https://phpackages.com/badges/red-code-master-package/health.svg)](https://phpackages.com/packages/red-code-master-package)
```

PHPackages © 2026

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