SRP: Single Responsability Principle

Introduction

Definition

Example

Item.php
Stock.php
ShoppingCart.php
  • EmailService: For sending emails (invoice)
EmailService.php
  • PrintingService: For printing any text: in our case the text represent the invoice.
PrintingService.php
  • InvoiceService: For generating invoice and using the both Printing and Email Services.
InvoiceService.php
Demo.php

Important

Conclusion

--

--

--

PHP Developer — Content Creator

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Introducing Kaleido:

Improve Brute Force

Ruby on Rails — My Likes and Dislikes

Make Your Code Glow on VS Code

Cubemaps And Mirror Surfaces in OpenGL | Environment Mapping

Cruising Towards a Month

The Road To Masonite 2.0

How to configure Microsoft Teams Direct Routing with Local Media Optimization using Ribbon SBCs

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Hicham BEN KACHOUD

Hicham BEN KACHOUD

PHP Developer — Content Creator

More from Medium

LSP: Liskov Substitution Principle

Null object design pattern in PHP — StudySection Blog

Null object design pattern in PHP — StudySection Blog

Automation — PHP Code Formatting before(pre) git commit

PHP — CodeSniffer standard