Skip to content

Exemplo prático da aplicação do strategy design pattern num projeto em Laravel

Notifications You must be signed in to change notification settings

ardosobral/talk-srp-laravel

Repository files navigation

Laravel Logo

Build Status Total Downloads Latest Stable Version License

Installation

First of all let's clone the project:

git clone [email protected]:leo98barros/talk-srp-laravel.git

With composer and PHP ^8.1 configured on your machine:

composer install

If the installation has not copied the env.example file, copy it and rename it to .env only and run:

php artisan key:generate

Here I am using SQLITE to make the database configuration easier, but to make this possible

  1. Create a database.sqlite file inside the database folder;
  2. Paste the absolute path in the .env file under the DB_DATABASE key;
  3. Lastly run:
php artisan migrate

About the propouse

The idea of ​​the project is to show how an example of folders would look if the Repository and Service patterns were implemented. Both are independent of each other, but the proposal here is to use them together. These diagrams represent what is being proposed here:

  • MVC architecture:

Base Service   Repository Pattern-MVC drawio

  • Service & Repository Pattern:

Base Service   Repository Pattern-Service   Repository Pattern drawio

  • MVC + SRP (Service & Repository Pattern):

Base Service   Repository Pattern-MVC + SRP drawio

  • Folder layout:

Base Service   Repository Pattern-Esquema de pastas drawio

Api Documentation

About

Exemplo prático da aplicação do strategy design pattern num projeto em Laravel

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published