Here I speak about how you can quickly spin up a Laravel application and related topic such as Design Principles, Best practices, TDD and many more.
Take a look and share you thoughts.
Cheers!
4. Choose your ground.
● Why Laravel? what the community says
○ https://laravel-news.com/2016-survey
● Is it perform well? let's ask from Taylor Otwell
○ https://medium.com/@taylorotwell/benchmarking-laravel-symfony-zend-2c01c2b270f8
● RAD
● Small to mid to enterprise level
● Lumen for Micro-services
5. Choose your ground.
● Env
○ Lamp/Homestead/Valet/Docker
● Editor
○ Phpstorm/sublime
○ Postman for api testing
7. Install
● Latest version is Laravel 5.4
● Laravel 5.5 is going to be the new LTS version, which is in final stage of
development.
● Install Using Laravel Installer
○ composer global require "laravel/installer"
○ laravel new --dev api.acme
● Install Via composer create-project
○ composer create-project laravel/laravel api.acme dev-develop
8. Structure
● Artisan - laravel cli
● .env vs .env.example
● .gitignore
● composer.json Vs composer.lock
● composer install Vs composer update
● public/Index.php
● config/app.php
● http/Kernal.php & console/Kernal.php
● phpunit.yml
● storage/log/laravel.log
● Use git right from start!
● Always use PSR! (http://www.php-fig.org/psr)
15. Scope,
"In Acme Corp,
a user can create many products.
A product can have many tags and vise versa.
When the product is created, a confirmation email should be
sent to the user."
17. Convention Over Configuration
● Introduced by David Heinemeier Hansson
to describe the philosophy of the Ruby on
Rails web framework.
● Applies to any framework.
● Ex: If there is a class “Category” in the
model, the corresponding table in the
database is called "categories" by default.
● It is only if one deviates from this
convention, such as the table
"product_categories", that one needs to
write code regarding these names.
19. ● In Route/Controller/Model or use Repository/Service or use Module?
● Why Migration and seeds needed?
● How to validate requests?
● Why Event-Listeners and when to use domain events.
● How to trigger Email properly?
● Why and when middleware
○ Ex: trim, null string. Auth
● Keep things SOLID!
Where should my code go?
Unit test
Acceptance test/ feature test
Php unit framework
I’m creating this sample app
Explain Different components of Laravel and best practices.
Ex
users and posts -> post_user
Always a best practice to create a domain folder and put the code inside
I’m going to use the approach we use in Clouddecor
That is create a domain folder
And create separate modules