PHPackages                             eazybright/repository-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. [Framework](/categories/framework)
4. /
5. eazybright/repository-package

ActiveLibrary[Framework](/categories/framework)

eazybright/repository-package
=============================

A package for managing repository design pattern

1.0.1(3y ago)64.2kMITPHPPHP ^8.0|^7.4CI failing

Since Apr 25Pushed 3y ago3 watchersCompare

[ Source](https://github.com/Eazybright/repository-package)[ Packagist](https://packagist.org/packages/eazybright/repository-package)[ RSS](/packages/eazybright-repository-package/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

Repository Package
==================

[](#repository-package)

[![hero](https://camo.githubusercontent.com/745a9bfb8880fd37911ab742bc2b45eadb04aa445083ee4aaf5ba19ec8be7801/68747470733a2f2f6d69726f2e6d656469756d2e636f6d2f6d61782f313531322f302a374a52786d6f36794b5f444c646f5a6c2e706e67)](https://camo.githubusercontent.com/745a9bfb8880fd37911ab742bc2b45eadb04aa445083ee4aaf5ba19ec8be7801/68747470733a2f2f6d69726f2e6d656469756d2e636f6d2f6d61782f313531322f302a374a52786d6f36794b5f444c646f5a6c2e706e67)

##### Photo Credit: [Repository design pattern done right in Laravel | by Daan | ITNEXT](https://itnext.io/repository-design-pattern-done-right-in-laravel-d177b5fa75d4)

[](#photo-credit-repository-design-pattern-done-right-in-laravel--by-daan--itnext)

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

[](#introduction)

This package main purpose is to manage repository design pattern in your laravel projects. It helps you create your repository and interface files respectively with a single command.

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

[](#installation)

To install this package run:

```
composer require eazybright/repository-package
```

This will install the package into your project.

Usage
-----

[](#usage)

Next, create a repostory file by running:

```
php artisan repository:create Blog
```

Make sure to provide your own argument name when running the above command, I used *Blog* as an example.

Once the command run, it creates the repository files `App\Repositories\BlogRepository.php`, `App\Repositories\Interfaces\BlogRepositoryInterface.php` and also create a service provider file in `App\Providers\RepositoryServiceProvider.php`.

You need to register the service provider. Open up `config/app.php` and add the following to the `providers` key.

```
'providers' => [
    ...
    App\Providers\RepositoryServiceProvider::class,
    ...
]
```

The Repository file will be registered into `RepositoryServiceProvider::class` whenever it is created.

```
