- The Project is a Decoupled Modular Monolithic App : HMVC Modules (you can turn on/off each module and republish/reuse it at another project)
- Module Structure (Repository Design Pattern)
- Separated/Attached Tests
• Persona Module (Authentication & Authorization) : reusable module called zaghloul-soft/persona-module the user,admin module separated from the app also default middlewares overrided this gives you the following benefits : - ability to insert a new module like (Food Delivery) - utilize your admin,user data again at any project - separate it to a microservice in case of high traffic. ------------------------------------------------------- • Ecommerce Module (Core Module) : reusable module both modules now you can require it through composer at any project. ------------------------------------------------------- • ERD : - Product (M) => <= (M) Category - Category (O) => (M) Category [self relation] ------------------------------------------------------- • Optimize DB : - index for searchable columns - Cacheing - Bulk Insertion - Eager Loading - Generators to yield data (cursorPagination) - DB transactions in case of multiple table insertion ------------------------------------------------------- • Seed : using Queues with ability to use Bus Batches ------------------------------------------------------- • Realtime Search : livewire • Cache : Redis using L5 Repository - when to forget cache ? (update - insert - delete) ------------------------------------------------------- • Service - Repository Layer (benefits): - make your code reusable ex: indexProducts can be used for query in both api/web only the response type will changed. ------------------------------------------------------- • Component - View Layer (benefits): - make your code reusable ex: - you can use you product component at any page you need. ------------------------------------------------------- • Form Request (DTO "Data Transfer Object") (benefits): - make your code reusable ex: CreateProductRequest Used 3 times for (api/web/CLI) ------------------------------------------------------- • Storage : S3 Public Bucket (data not sensitive) • Admin Registration Enabled for dev purpose only ------------------------------------------------------- • Tests: - both (unit/feature)
sail php artisan create:product {name} {price} {--description="mobile phone"} {--category_ids=1,2}
Requirements (all can be installed automatically using docker desktop): --------------- - PHP 8.2 - Run Docker Desktop - MySQL 8.0 - Redis - SQL lite PHP Extension
Run the following at the project root dir Terminal ---------------
- Download Vendor folder composer install
- Make Sail alias alias sail='[ -f sail ] && sh sail || sh vendor/bin/sail'
- Generate .env file from .env.decrypted: php artisan env:decrypt --key=base64:2xrR+5fd4VR6vgogEwkApSj9LBsVafhyafO1XCoumYo= --force
- Laravel Sail install php artisan sail:install
- Run Your local server up: sail up -d
- Run Your local server down: sail down
- To Run Unit/Feature Tests but configure your test with xdebug sail php artisan test --testsuite={Modules or ModuleName}
if you have an issue you can see Laravel Sail