Skip to content

WIP: A comprehensive Domain-Driven Design example with problem space strategic analysis and various tactical patterns.

License

Notifications You must be signed in to change notification settings

ddd-by-examples/library-php

Repository files navigation

Library (PHP)

Minimum PHP Version ci GitHub

The project is currently under development. Some solutions are temporary and may change. Which doesn't mean you can't learn from it 😉.

A comprehensive Domain-Driven Design example with problem space strategic analysis and various tactical patterns.

Reference: https://github.com/ddd-by-examples/library

About

This is a project of a library, driven by real business requirements. We use techniques strongly connected with Domain Driven Design, Behavior-Driven Development, Event Storming, User Story Mapping.

Domain description

A public library allows patrons to place books on hold at its various library branches. Available books can be placed on hold only by one patron at any given point in time. Books are either circulating or restricted, and can have retrieval or usage fees. A restricted book can only be held by a researcher patron. A regular patron is limited to five holds at any given moment, while a researcher patron is allowed an unlimited number of holds. An open-ended book hold is active until the patron checks out the book, at which time it is completed. A closed-ended book hold that is not completed within a fixed number of days after it was requested will expire. This check is done at the beginning of a day by taking a look at daily sheet with expiring holds. Only a researcher patron can request an open-ended hold duration. Any patron with more than two overdue checkouts at a library branch will get a rejection if trying a hold at that same library branch. A book can be checked out for up to 60 days. Check for overdue checkouts is done by taking a look at daily sheet with overdue checkouts. Patron interacts with his/her current holds, checkouts, etc. by taking a look at patron profile. Patron profile looks like a daily sheet, but the information there is limited to one patron and is not necessarily daily. Currently a patron can see current holds (not canceled nor expired) and current checkouts (including overdue). Also, he/she is able to hold a book and cancel a hold.

How actually a patron knows which books are there to lend? Library has its catalogue of books where books are added together with their specific instances. A specific book instance of a book can be added only if there is book with matching ISBN already in the catalogue. Book must have non-empty title and price. At the time of adding an instance we decide whether it will be Circulating or Restricted. This enables us to have book with same ISBN as circulated and restricted at the same time (for instance, there is a book signed by the author that we want to keep as Restricted)

How to build and run

The code below will boot the project, install all dependencies and run the build script (code style check, static analysis and all tests):

make up
make ci

Interactive shell

make bash

References

  1. Introducing EventStorming by Alberto Brandolini
  2. Domain Modelling Made Functional by Scott Wlaschin
  3. Software Architecture for Developers by Simon Brown
  4. Clean Architecture by Robert C. Martin
  5. Domain-Driven Design: Tackling Complexity in the Heart of Software by Eric Evans

About

WIP: A comprehensive Domain-Driven Design example with problem space strategic analysis and various tactical patterns.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages