mzshovon/auto-repo

Single command repo generation for Laravel

1.0.7 2025-01-19 16:23 UTC

README

Laravel single command repository pattern generator with automatic binding.

Installation

You can install the package using composer:

composer require mzshovon/auto-repo

Register providers to your app config file.

Mzshovon\AutoRepo\RepositoryServiceProvider::class,
Mzshovon\AutoRepo\BindServiceProvider::class,

Great! Now your setup is done and you are ready to generate repository lifecycle in laravel via single command.

# For only generate interface with specific functions
php artisan generate:repo Test

Then it will ask for:

Do you want to bind model?
> yes # It will generate the model repo

If it is "no" Then it will ask for:

Do you want to bind service?
> yes # It will generate the service repo

Please make sure to cache the config after register providers.

php artisan config:cache

No need to bind! Just use your contract to access repository instances from anywhere.

License

MIT