LaravelPackages.net
Acme Inc.
Toggle sidebar
eazybright/repository-package

A package for managing repository design pattern

4.246
6
1.0.1
About eazybright/repository-package

eazybright/repository-package is a Laravel package for a package for managing repository design pattern. It currently has 6 GitHub stars and 4.246 downloads on Packagist (latest version 1.0.1). Install it with composer require eazybright/repository-package. Discover more Laravel packages by eazybright or browse all Laravel packages to compare alternatives.

Last updated

Repository Package

hero

Photo Credit: Repository design pattern done right in Laravel | by Daan | ITNEXT

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

To install this package run:

composer require eazybright/repository-package

This will install the package into your project.

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.

<?php
...
    use App\Repositories\Interfaces\BlogRepositoryInterface;
    use App\Repositories\BlogRepository;

    ...

    public function register()
    {
        $this->app->bind(
            BlogRepositoryInterface::class,
            BlogRepository::class
        )
    }
...

Contributing

Please feel free to star and fork this package. You can also contribute by submitting a pull request to enhance the functionalities.

License

The MIT License (MIT). Please see License File for more information.

Star History Chart