anik / repository-generator
This package is abandoned and no longer maintained.
No replacement package was suggested.
Repository generator generates repository classes as it requires for repottern package.
1.0.0
2016-07-07 11:05 UTC
Requires
- php: >=5.5
- illuminate/support: ~5
This package is auto-updated.
Last update: 2020-05-01 14:58:09 UTC
README
Repository generator generates the Repository class that's how it's required for the Repottern. Have a look at repottern
Requirements:
- Laravel >= 5
- PHP >= 5.5
How to install?
composer require anik/repository-generator
- Add
Anik\Generator\Providers\RepositoryGeneratorServiceProvider::class
to the providers array in config/app.php - After the installation, run
php artisan vendor:publish
. This will copy the config file to Laravel's config directory namedgenerator.php
Configuration:
- namespace: The namespace you want to have for the class.
- dir: The path the file will be saved
- model_namespace: The model namespace, if you want to return from the class on the fly. Don't append any slash.
Usages:
The artisan console has one mandatory argument and 3 optional arguments.
- Mandatory argument
- Class name: The class name you want as a repository. Must be a valid identifier.
- Optional arguments
- --dir=dir_name. if specified, the new class will be created on that directory.
- --namespace=namespace. if specified, then class will have that namespace.
- --model=model. if specified, will lookup using the config file's model_namespace. If found, then will be returned from the implemented model() method. Otherwise, will be left blank.
Example:
php artisan make:repository UserRepository
php artisan make:repository UserRepository --namespace=Repository
php artisan make:repository UserRepository --model=User
php artisan make:repository UserRepository --namespace=Repository --model=User
Note:
Here, the optional arguments can be used at any position
If the --dir argument is specified, then the directory will be created regarding the current path
License:
Repository Generator is released under the MIT Licence.
Bugs and Issues:
Well, I'll always appreciate if you find any bug or issue. Feel free to inform. Anyway, forks are welcomed too.