PHPackages                             ticaje/booking-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. ticaje/booking-api

ActiveLibrary[API Development](/categories/api)

ticaje/booking-api
==================

Hexagonal Design based PHP middleware for defining Booking Use Cases given any PHP based solution

2.0.0(1y ago)016GPL-3.0PHPPHP ^7.1 || ^8.0

Since Jun 9Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/ticaje/booking-api)[ Packagist](https://packagist.org/packages/ticaje/booking-api)[ RSS](/packages/ticaje-booking-api/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (7)Versions (10)Used By (0)

Booking Based API
=================

[](#booking-based-api)

[![GPLv3 License](https://camo.githubusercontent.com/19f3b8cdb6c4ca7671e1af3240e94eb087c2b0c1181a3357d8381af53c9d40cb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c76332d6d6172626c652e737667)](https://www.gnu.org/licenses/gpl-3.0.en.html)[![Latest Version on Packagist](https://camo.githubusercontent.com/9bfa4efe8ee4c927a94104f769f369cf7b3fb00c94bc09a339e49f59badec38a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746963616a652f626f6f6b696e672d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ticaje/booking-api)[![Quality Score](https://camo.githubusercontent.com/cb39d2b8cc591c2b344418ea14c772192da855eaac4d897f3a1eb292345ff584/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746963616a652f626f6f6b696e672d6170692e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/ticaje/booking-api)[![Total Downloads](https://camo.githubusercontent.com/8d58fb0b80be24d2b2617593b0b4e12949ed91a63c2e00b3e8a0de0fc8556dea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746963616a652f626f6f6b696e672d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ticaje/booking-api)[![Author](https://camo.githubusercontent.com/3c3154e7d1e6e1d3c45389165493e28fc0279eced5a2b180bc66058f847196ff/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f48424c61746572616c2e636f6d2d2532333032313133613f7374796c653d6c6162656c436f6c6f723d6c6967687467726579)](https://hblateral.com)

Preface
-------

[](#preface)

This is a Middleware that uses Hexagonal Design pattern to connect Booking based solutions, that are defined on specific frameworks/platforms even PHP standalone based solutions, with Domain specific API. This library creates the High Level Policies and standard Use Cases to Booking Domain Modeling.

Installation
------------

[](#installation)

```
composer require ticaje/booking-api
```

High Level Policies
-------------------

[](#high-level-policies)

A Booking business is about making reservations so the key domain objects to this are:

#### Subject of Booking: Hotel Room, Car etc. Let's call it from now on: Main Domain Resource.

[](#subject-of-booking-hotel-room-car-etc-lets-call-it-from-now-on-main-domain-resource)

This is the main value object to Booking domain. Is the main subject to model.

#### Calendar

[](#calendar)

The main context to value objects is the calendar cause booking means making reservations based on time(days, hours). The policies defined in this domain component are related to enabled/disabled days or periods for a Calendar according to concrete Main Domain Resource.

#### Prices

[](#prices)

A reservation is subjected to the price a client must pay for that good or service. There are a series of price rules to reservations that only belong to Domain grounds, and those policies depend on Calendar object, and its policies are in alignment with Calendar's. Our API defines basic/standard price rules that can be extended by consumers of this API. The way our API calculates prices can be extended by stakeholders.

#### Availability

[](#availability)

Pretty much like prices, availability is another Domain object that handles the current business in terms of booking occupations. This domain component depends on Calendar object and its policies are in alignment with Calendar's.

Use Cases
---------

[](#use-cases)

A use case is a Domain scenario that expects a System to fulfill specific business goal a specific actor needs hence its interaction with the system. It has pre-conditions, post-conditions, business rules and process flow(normal and alternate). Basically a Use Case represents a request to system by an actor where the system itself responds to such request based on business policies. A high level system is built upon Use Cases for the sake of granularity and separation of concerns principle.

#### Example of Use Case

[](#example-of-use-case)

An example of a Use Case could be:

- Get availability for given business resource &amp; specific date.
- Get price given for business resource &amp; specific date.

### Low Level Detail Grounds

[](#low-level-detail-grounds)

We have implemented a specific Use Case based approach that implies a hexagonal-based library called ticaje/hexagonal. This library allows us to inject any Use-Case-based lower level library that orchestrates the machinery to handle Use Cases using the ***Bus/Command/Handler*** design pattern.

It may seem sophisticated and complicated at first blush but, it's actually just the opposite. The idea behind ***Bus/Command/Handler*** is to create a Use Case and, accomplishing it by creating a Command, associate it to a Handler by using a Bus component that maps commands to handlers using a library like Tactician(the one we inject) to orchestrate the business model. The Handler receives a business DTO that is interpreted whether in a Application Service or the handler itself. In our current solution we have created Application Services so it can be consumed by external agencies without the need of Use Case approach. The difference of using Use Case approach is that we can call it from any context by just instatiating a Command, passing it along to proper Bus method and, Handler does the rest.

Fully Hexagonal
---------------

[](#fully-hexagonal)

The DTO is the key to decouple the persistence of data from Domain objects cause is governed by an interface or service contract that seals the domain policy to receive the data that Domain understands, so is responsibility of consumers to make proper transformations to a valid Type that Domain expects.

Also, it can be included in any platform or application cause is created independent from any infrastructure related agencies, it only depends on few low level libraries that has no great dependencies on rich agencies.

You can use it within the context of any Framework or platform, you are free to use Dependency Inversion(approach I recommend the most) or make manual instatiation(for standalone apps) which I do not recommend very much cause it could affect agile goals. The idea behind Hexagonal is to frame solutions using a DI framework or something like Laravel or Symfony that already include one out of the box.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance66

Regular maintenance activity

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~173 days

Recently: every ~343 days

Total

9

Last Release

417d ago

Major Versions

1.0.7 → 2.0.02025-03-27

PHP version history (2 changes)1.0.0PHP ^7.1

2.0.0PHP ^7.1 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/972ffc9fba0b074b4bd8c9550ff68cea1c8ddcd9e5f7b21980257eaa4e582720?d=identicon)[ticaje](/maintainers/ticaje)

---

Top Contributors

[![ticaje](https://avatars.githubusercontent.com/u/1042962?v=4)](https://github.com/ticaje "ticaje (6 commits)")

---

Tags

Booking ProductPHP Hexagonal DesignUse Case based API

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/ticaje-booking-api/health.svg)

```
[![Health](https://phpackages.com/badges/ticaje-booking-api/health.svg)](https://phpackages.com/packages/ticaje-booking-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
