This is a simple package for generating standard templates for the repository pattern.
You can install the package via composer:
composer require jakejames/automated-repositories --dev
Publish the config file:
php artisan vendor:publish --tag=config
Run the following command:
php artisan make:repository { name }
We recommend using the following pattern for naming:
- RegisterRepository
- LoginRepository
This will use the word before 'Repository' as your contract name and service provider name
E.g 'LoginRepository' will generate the following files: LoginRepository, Login (contract), LoginServiceProvider
Once the files have been generated, the command will attempt to register the new service provider inside your config/app.php
Since lumen doesn't support publishing config files, you'll need to create your own config file called automatedRepositories this should contain the following:
return [
'directory' => [
'repositories' => 'App/Repositories',
'contracts' => 'App/Contracts',
'providers' => 'App/Providers'
]
];
Once you've added the config, it needs to be registered inside of app.php like so:
$app->configure('app');
The final step is to register the command inside of kernel.php
protected $commands = [
MakeRepositoryCommand::class
];
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email jake@jump24.co.uk instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.