matheusfsc28 / layercraft
A package to generate layered architecture (Controller, Service, Interface, Repository, Model) in Laravel applications.
Requires
- php: >=8.1
- illuminate/console: ^8.0 || ^9.0 || ^10.0
- illuminate/support: ^8.0 || ^9.0 || ^10.0
README
LayerCraft_PT
LayerCraft é um pacote para gerar uma arquitetura em camadas (Controller, Service, Interface, Repository, Model) em aplicaçáes Laravel. Ele facilita a organização do código e promove boas prÑticas de desenvolvimento de maneira Ñgil.
Instalação
VocΓͺ pode instalar o pacote via Composer. Execute o seguinte comando no seu terminal:
composer require matheusfsc28/layercraft
Como usar
No seu terminal, na pasta do seu projeto Laravel, execute o seguinte comando:
php artisan layercraft <YourClassName>
Isso criarΓ‘ a seguinte estrutura no projeto:
/seu-projeto βββ app/ β βββ Http/ β β βββ Controllers/ β β βββ <YourClassName>Controller.php β βββ Interfaces/ β β βββ <YourClassName>Interface.php β βββ Models/ β β βββ <YourClassName>.php β βββ Repositories/ β β βββ <YourClassName>Repository.php β βββ Services/ β βββ <YourClassName>Service.php
VocΓͺ tambΓ©m pode criar suas subpastas para manter a organização de acordo com suas necessidades:
php artisan layercraft <YourSubFolder>\<YourClassName>
A estrutura ficarΓ‘ da seguinte maneira:
/seu-projeto βββ app/ β βββ Http/ β β βββ Controllers/ β β βββ <YourSubFolder>/ β β βββ <YourClassName>Controller.php β βββ Interfaces/ β β βββ <YourSubFolder>/ β β βββ <YourClassName>Interface.php β βββ Models/ β β βββ <YourSubFolder>/ β β βββ <YourClassName>.php β βββ Repositories/ β β βββ <YourSubFolder>/ β β βββ <YourClassName>Repository.php β βββ Services/ β βββ <YourSubFolder>/ β βββ <YourClassName>Service.php
Estrutura Detalhada
- Controllers: ContΓ©m a lΓ³gica do controlador.
- Interfaces: Define a interface que o repositΓ³rio deve implementar.
- Models: Representa a entidade no banco de dados.
- Repositories: ContΓ©m a lΓ³gica de acesso a dados.
- Services: Implementa a lΓ³gica de negΓ³cios.
Licença
Este projeto estÑ licenciado sob a Licença MIT. Veja o arquivo LICENSE para mais detalhes.
Contato
Se vocΓͺ tiver dΓΊvidas ou sugestΓ΅es, entre em contato:
- Nome: Matheus Felipe
- Email: dev.matheusfelipe@gmail.com
- GitHub:
- LinkedIn:
LayerCraft_EN
LayerCraft is a package to generate a layered architecture (Controller, Service, Interface, Repository, Model) in Laravel applications. It helps organize the code and promotes good development practices in an agile way.
Installation
You can install the package via Composer. Run the following command in your terminal:
composer require matheusfsc28/layercraft
How to use
In your terminal in the root of your Laravel project, run the following command:
php artisan layercraft <YourClassName>
This will create the following structure in the project:
/your-project βββ app/ β βββ Http/ β β βββ Controllers/ β β βββ <YourClassName>Controller.php β βββ Interfaces/ β β βββ <YourClassName>Interface.php β βββ Models/ β β βββ <YourClassName>.php β βββ Repositories/ β β βββ <YourClassName>Repository.php β βββ Services/ β βββ <YourClassName>Service.php
You can also create your subfolders to keep according to your organization:
php artisan layercraft <YourSubFolder>\<YourClassName>
The structure will be as follows:
/your-project βββ app/ β βββ Http/ β β βββ Controllers/ β β βββ <YourSubFolder>/ β β βββ <YourClassName>Controller.php β βββ Interfaces/ β β βββ <YourSubFolder>/ β β βββ <YourClassName>Interface.php β βββ Models/ β β βββ <YourSubFolder>/ β β βββ <YourClassName>.php β βββ Repositories/ β β βββ <YourSubFolder>/ β β βββ <YourClassName>Repository.php β βββ Services/ β βββ <YourSubFolder>/ β βββ <YourClassName>Service.php
Detailed Structure
- Controllers: Contains the controller logic.
- Interfaces: Defines the interface that the repository must implement.
- Models: Represents the entity in the database.
- Repositories: Contains the data access logic.
- Services: Implements the business logic.
Contact
If you have any questions or suggestions, please contact:
- Name: Matheus Felipe
- Email: dev.matheusfelipe@gmail.com
- GitHub:
- LinkedIn: