jakejames / automated-repositories
Generates a boilerplate repository pattern
Requires
- php: >=7.2
- illuminate/support: ^5.0|^6.0|^7.0
Requires (Dev)
- mockery/mockery: ^1.3.1
- orchestra/testbench: ^4.0|^5.0
- phpunit/phpunit: ^6.0|^7.0|^8.0
This package is auto-updated.
Last update: 2024-11-14 04:05:26 UTC
README
This is a simple package for generating standard templates for the repository pattern.
Installation
You can install the package via composer:
composer require jakejames/automated-repositories --dev
Usage Laravel 5+
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
Usage Lumen
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
];
Running Tests
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email jake@jump24.co.uk instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.