It's a simple repository file generator.
If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php
LaravelRepositoryPattern\Providers\RepositoryPatternProvider::class
to publish the config file:
php artisan vendor:publish --provider="LaravelRepositoryPattern\Providers\RepositoryPatternProvider"
php artisan make:repository User
Will generate UserRepository.php and UserInterface.php file
Example using generated repo in controller
<?php
namespace App\Http\Controllers;
use App\Repositories\UserRepository;
class HomeController extends Controller
{
protected UserRepository $user;
public function __construct(UserRepository $user)
{
$this->user = $user;
}
public function index()
{
return $this->user->getAll();
}
}