Malas Coding dengan Laravel Framework

PHPID-OL @2021

@DyanGalih

Who am i?

IT Enthusiast, Cloud and Mobile Security Enthusiast, Public speaker


A Simple Person Who Loves Code, Share Knowledge and Always Learning all about IT and security.

Project Structure

  • Controllers - Handling the incoming requests and sending back responses
  • Services - Business logic
  • Repositories - responsible for interacting with databases or endpoint
  • Models - interact with that table

Design Patterns?

Design Patterns are reusable solutions to commonly occuring problems(in the context of software design). Design patterns were started as best practices that were applied again and again to similar problems encountered in different contexts

source : https://www.oodesign.com/

MVC

Repository Patterns?

Trait

<?php
trait Message {
public function print() {
    echo "OOP is fun! ";
  }
}
class Welcome {

   use Message;
}
$obj = new Welcome();
$obj->print();

POPO

Plain Old {Insert Language Here} Object is an simple approach that says you don't always need to use an extensive class to store data or perform logic.

class HelloWorld{
    private $value;
    public function getValue(): ?string
    {
        return $this->value;
    }
    public function setValue(string $value) {
        $this->value = $value;
    }
}

Best Practice POPO

class HelloWorld{
      /**

      * @var string

      */

      public $value;

      /**

      * @var string

      */

      public $name;

}

Dependency Injection?

Dependency Injection

TDD(Test Driven Development)

TDD(Test Driven Development)

Php Packages

Packagist

Laravel Component

<x-component />

Lazy Tools

Lazy Project

Alpha Release Soon.

?

Terimakasih

Made with Slides.com