PHP Classes

PHP Solid Principles Examples: Good and bad examples to show the SOLID principles

Recommend this page to a friend!
  Info   View files Documentation   View files View files (21)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2022-08-26 (3 months ago) RSS 2.0 feedNot enough user ratingsTotal: 104 This week: 1All time: 9,592 This week: 491Up
Version License PHP version Categories
solid-principles 1.0.0The PHP License5PHP 5, Design Patterns
Description Author

This package provides good and bad examples to show the SOLID principles.

It provides classes that show how to implement the SOLID principles in PHP.

The packages has classes showing the principles:

- Single responsibility: there should never be more than one reason for a class to change

- Open–closed: entities should be open for extension, but closed for modification

- Liskov substitution: Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it

- Interface segregatios: clients should not be forced to depend upon interfaces that they do not use

- Dependency inversion: Depend upon abstractions, not concretions

Innovation Award
PHP Programming Innovation award nominee
August 2022
Number 9
SOLID is a set of principles developers should follow to develop good software.

Developers that follow the SOLID principles will be able to create software projects that are well structured and easier to maintain.

These principles help developers that create the software components or use the components of other developers to be more productive.

This package provides a PHP implementation of good and bad examples of classes that follow the SOLID principle or not.

Other developers may learn to follow the SOLID principles in practice with these example classes.

Manuel Lemos
Picture of Nahidul Hasan
  Performance   Level  
Name: Nahidul Hasan <contact>
Classes: 11 packages by
Country: Bangladesh Bangladesh
Age: ???
All time rank: 277235 in Bangladesh Bangladesh
Week rank: 65 Up5 in Bangladesh Bangladesh Up
Innovation award
Innovation award
Nominee: 7x

  Files folder image Files  
File Role Description
Files folder imageDependencyInversionPrinciple (2 files)
Files folder imageInterfaceSegregationPrinciple (2 directories)
Files folder imageLiskovSubstitutionPrinciple (3 files)
Files folder imageOpenClosedPrinciple (2 directories)
Files folder imageSingleResponsiblityPrinciple (2 directories)
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file README_ID.md Doc. Documentation

  Files folder image Files  /  DependencyInversionPrinciple  
File Role Description
  Plain text file DependencyInversionExample.php Class Class source
  Plain text file DependencyInversionViolation.php Class Class source

  Files folder image Files  /  InterfaceSegregationPrinciple  
File Role Description
Files folder imageBadDesign (1 file)
Files folder imageGoodDesign (1 file)

  Files folder image Files  /  InterfaceSegregationPrinciple  /  BadDesign  
File Role Description
  Plain text file InterfaceSegregationViolateExample.php Class Class source

  Files folder image Files  /  InterfaceSegregationPrinciple  /  GoodDesign  
File Role Description
  Plain text file InterfaceSegregationExample.php Class Class source

  Files folder image Files  /  LiskovSubstitutionPrinciple  
File Role Description
  Plain text file LiskobSubstituitionExample3.php Class Class source
  Plain text file LiskovSubstitutionExample2.php Class Class source
  Plain text file LiskovSubstitutonExample1.php Class Class source

  Files folder image Files  /  OpenClosedPrinciple  
File Role Description
Files folder imageBadDesign (3 files)
Files folder imageGoodDesign (4 files)

  Files folder image Files  /  OpenClosedPrinciple  /  BadDesign  
File Role Description
  Plain text file Circle.php Class Class source
  Plain text file CostManager.php Class Class source
  Plain text file Rectangle.php Class Class source

  Files folder image Files  /  OpenClosedPrinciple  /  GoodDesign  
File Role Description
  Plain text file AreaInterface.php Class Class source
  Plain text file Circle.php Class Class source
  Plain text file CostManager.php Class Class source
  Plain text file Rectangle.php Class Class source

  Files folder image Files  /  SingleResponsiblityPrinciple  
File Role Description
Files folder imageBadDesign (1 file)
Files folder imageGoodDesign (3 files, 1 directory)

  Files folder image Files  /  SingleResponsiblityPrinciple  /  BadDesign  
File Role Description
  Plain text file OrdersReport.php Class Class source

  Files folder image Files  /  SingleResponsiblityPrinciple  /  GoodDesign  
File Role Description
Files folder imageRepositories (1 file)
  Plain text file HtmlOutput.php Class Class source
  Plain text file OrdersOutPutInterface.php Class Class source
  Plain text file OrdersReport.php Class Class source

  Files folder image Files  /  SingleResponsiblityPrinciple  /  GoodDesign  /  Repositories  
File Role Description
  Plain text file OrdersRepository.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:104
This week:1
All time:9,592
This week:491Up