bfg/repository

Missing repositories for Eloquent models Laravel

Maintainers

👁 bfg

Package info

github.com/bfg-s/repository

Type:bfg-app

pkg:composer/bfg/repository

Statistics

Installs: 66 156

Dependents: 5

Suggesters: 0

Stars: 1

Open Issues: 0

v1.6.0 2025-07-05 01:59 UTC

Requires

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 5f59e92e9c570eabf4d684d730aa5e81ba9d5d59

  • bfg

repositoryextensionlaravel

This package is auto-updated.

Last update: 2026-06-05 03:55:15 UTC


README

Package To add the functionality of the repository pattern and its generator.

Install

composer require bfg/repository

About

The main feature of this package is the ability to remember the result of the executed function and return it when called again with the same parameters. How does this happen? When a repository property is called, it remembers the parameters and the result of the function. When the property is called again, it will return the result of the function that was remembered the first time it was called. For example, the repository has a getUsers() method that returns all users. The first time a method is called by a property, i.e. $repository->getUsers, it will execute the method and remember the result. When the property is called again, it will return the result of the method that was remembered the first time it was called.

Usage

Make repository

php artisan make:repository
Options:
 --methods[=METHODS] Methods for repository (multiple values allowed)
 -m, --model[=MODEL] Model of repository
 -f, --force Create the class even if the repository already exists

Next step

After generating the repository you will appear in the app/Repositories folder. And then you can add your methods to the created repository.