Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

luddinus's avatar

Create a new Repository with Artisan?

How can I create an empty repository with artisan? Like a model. Something like this:

php artisan make:repository UserRepository

which creates

<?php namespace App\Repositories;

class UserRepository extends BaseRepository {

    // 

}
0 likes
7 replies
toniperic's avatar

Just look at Illuminate\Foundation\Console\ModelMakeCommand and you can mimic it to suit your needs.

1 like
pmall's avatar

Yes there is no built in command to create a repository if you want this you have to create your own.

bobbybouwmann's avatar

The repository pattern is not connected to the framework, but it sure made it a lot more popular! It would be nice to have a generator for it though :P

Please or to participate in this conversation.