PHPackages                             tourze/hotel-contract-bundle - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. tourze/hotel-contract-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

tourze/hotel-contract-bundle
============================

酒店合同和库存管理模块，提供合同管理、库存管理、价格管理等功能

0.0.4(5mo ago)01461MITPHPCI passing

Since May 24Pushed 4mo agoCompare

[ Source](https://github.com/tourze/hotel-contract-bundle)[ Packagist](https://packagist.org/packages/tourze/hotel-contract-bundle)[ RSS](/packages/tourze-hotel-contract-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (48)Versions (5)Used By (1)

hotel-contract-bundle
=====================

[](#hotel-contract-bundle)

[English](README.md) | [中文](README.zh-CN.md)

\[[![Latest Version](https://camo.githubusercontent.com/75ccf723cd88e4bc20df4398dc450f34ff56b21997d6cc8fb43d7660f54f8a40/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f686f74656c2d636f6e74726163742d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/75ccf723cd88e4bc20df4398dc450f34ff56b21997d6cc8fb43d7660f54f8a40/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f686f74656c2d636f6e74726163742d62756e646c652e7376673f7374796c653d666c61742d737175617265)\] () \[[![PHP Version](https://camo.githubusercontent.com/34bd63718c9f0cff83c63cd7d3bb0b6325e78fce694aa26950aa31bd40a78484/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f686f74656c2d636f6e74726163742d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/34bd63718c9f0cff83c63cd7d3bb0b6325e78fce694aa26950aa31bd40a78484/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f686f74656c2d636f6e74726163742d62756e646c652e7376673f7374796c653d666c61742d737175617265)\] () \[[![License](https://camo.githubusercontent.com/6c057ff8608c9aa5b74403941de86fe41c274834cfaca7d386a08e49ccb01bb4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f686f74656c2d636f6e74726163742d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/6c057ff8608c9aa5b74403941de86fe41c274834cfaca7d386a08e49ccb01bb4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f686f74656c2d636f6e74726163742d62756e646c652e7376673f7374796c653d666c61742d737175617265)\] () \[[![Code Coverage](https://camo.githubusercontent.com/73ee3bab50824f778cedc6b4b3f78bcdab621eef812a979ec388b8ad692a4bff/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f746f75727a652f7068702d6d6f6e6f7265706f2e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/73ee3bab50824f778cedc6b4b3f78bcdab621eef812a979ec388b8ad692a4bff/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f746f75727a652f7068702d6d6f6e6f7265706f2e7376673f7374796c653d666c61742d737175617265)\] ()

Hotel contract management bundle for Symfony applications, providing comprehensive hotel contract management, inventory management, and price management features. Supports batch operations, inventory warnings, and automatic synchronization.

This bundle integrates deeply with EasyAdmin for administration interface and provides complete hotel contract lifecycle management including inventory tracking and price optimization.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
    - [System Requirements](#system-requirements)
    - [Composer Installation](#composer-installation)
- [Features](#features)
- [Usage](#usage)
    - [1. Register Bundle](#1-register-bundle)
    - [2. Configure Database](#2-configure-database)
    - [3. Admin Interface](#3-admin-interface)
- [Console Commands](#console-commands)
    - [app:inventory:check-warnings](#appinventorycheck-warnings)
- [Entity Reference](#entity-reference)
    - [HotelContract](#hotelcontract)
    - [DailyInventory](#dailyinventory)
    - [InventorySummary](#inventorysummary)
- [Enum Types](#enum-types)
    - [ContractStatusEnum](#contractstatusenum)
    - [ContractTypeEnum](#contracttypeenum)
    - [DailyInventoryStatusEnum](#dailyinventorystatusenum)
    - [InventorySummaryStatusEnum](#inventorysummarystatusenum)
- [Service Reference](#service-reference)
    - [ContractService](#contractservice)
    - [InventoryUpdateService](#inventoryupdateservice)
    - [InventorySummaryService](#inventorysummaryservice)
    - [InventoryWarningService](#inventorywarningservice)
    - [PriceManagementService](#pricemanagementservice)
    - [RoomTypeInventoryService](#roomtypeinventoryservice)
- [Development Guide](#development-guide)
    - [Architecture](#architecture)
    - [Custom Warning Rules](#custom-warning-rules)
    - [Batch Operations Example](#batch-operations-example)
- [Important Notes &amp; Best Practices](#important-notes-best-practices)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [License](#license)
- [Authors](#authors)
- [References](#references)

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

[](#installation)

### System Requirements

[](#system-requirements)

- PHP &gt;= 8.1
- Symfony &gt;= 6.4
- Doctrine ORM &gt;= 3.0

### Composer Installation

[](#composer-installation)

```
composer require tourze/hotel-contract-bundle
```

Features
--------

[](#features)

- **Contract Management**: Support for multiple contract types, including fixed price and bidding contracts
- **Inventory Management**: Manage hotel room inventory by room type and date
- **Price Management**: Support batch price adjustments, cost and selling price management
- **Inventory Warnings**: Automatically detect low inventory and send notifications
- **Batch Operations**: Support batch inventory creation and batch price updates
- **EasyAdmin Integration**: Complete admin interface provided

Usage
-----

[](#usage)

### 1. Register Bundle

[](#1-register-bundle)

```
// config/bundles.php
return [
    // ...
    Tourze\HotelContractBundle\HotelContractBundle::class => ['all' => true],
];
```

### 2. Configure Database

[](#2-configure-database)

Run database migrations to create required table structures:

```
php bin/console doctrine:migrations:migrate
```

### 3. Admin Interface

[](#3-admin-interface)

The bundle provides EasyAdmin CRUD controllers for comprehensive management:

- **Hotel Contracts** (HotelContractCrudController): Manage contract lifecycle, status, and pricing
- **Room Type Inventory** (RoomTypeInventoryCrudController): Control daily inventory by room type
- **Inventory Summary** (InventorySummaryCrudController): View aggregated inventory statistics

Console Commands
----------------

[](#console-commands)

### app:inventory:check-warnings

[](#appinventorycheck-warnings)

Monitor inventory levels and send notification emails when thresholds are reached.

**Usage:**

```
# Check inventory warnings directly
php bin/console app:inventory:check-warnings

# Sync inventory statistics before checking
php bin/console app:inventory:check-warnings --sync

# Check inventory for specific date
php bin/console app:inventory:check-warnings --date=2024-12-31
```

**Options:**

- `--sync`: Sync inventory statistics data before checking
- `--date`: Check inventory for specific date (format: Y-m-d)

Entity Reference
----------------

[](#entity-reference)

### HotelContract

[](#hotelcontract)

Hotel contract entity, key fields:

- `contractNo`: Contract number
- `hotel`: Associated hotel
- `contractType`: Contract type (Fixed Price/Bidding)
- `startDate`: Contract start date
- `endDate`: Contract end date
- `totalRooms`: Total room count
- `totalAmount`: Contract total amount
- `status`: Contract status (Pending/Active/Terminated)
- `priority`: Priority

### DailyInventory

[](#dailyinventory)

Daily inventory entity, key fields:

- `code`: Inventory code (unique identifier)
- `roomType`: Room type
- `hotel`: Hotel
- `date`: Date
- `contract`: Associated contract (optional)
- `costPrice`: Cost price (decimal)
- `sellingPrice`: Selling price (decimal)
- `profitRate`: Profit rate (decimal)
- `isReserved`: Is reserved (boolean)
- `status`: Inventory status (Available/Sold/Pending/Reserved/Disabled/Cancelled/Refunded)
- `priceAdjustReason`: Price adjustment reason (optional)
- `lastModifiedBy`: Last modified by user (optional)

### InventorySummary

[](#inventorysummary)

Inventory summary entity, key fields:

- `hotel`: Hotel
- `roomType`: Room type
- `date`: Date
- `totalRooms`: Total room count
- `availableRooms`: Available room count
- `reservedRooms`: Reserved room count
- `soldRooms`: Sold room count
- `status`: Status (Normal/Warning/Sold Out)
- `lowestPrice`: Lowest price

Enum Types
----------

[](#enum-types)

### ContractStatusEnum

[](#contractstatusenum)

- `PENDING`: Pending approval
- `ACTIVE`: Active
- `TERMINATED`: Terminated

### ContractTypeEnum

[](#contracttypeenum)

- `FIXED_PRICE`: Fixed price contract
- `BIDDING`: Bidding contract

### DailyInventoryStatusEnum

[](#dailyinventorystatusenum)

- `AVAILABLE`: Available
- `SOLD`: Sold
- `PENDING`: Pending
- `RESERVED`: Reserved
- `DISABLED`: Disabled
- `CANCELLED`: Cancelled
- `REFUNDED`: Refunded

### InventorySummaryStatusEnum

[](#inventorysummarystatusenum)

- `NORMAL`: Normal
- `WARNING`: Warning
- `SOLD_OUT`: Sold out

Service Reference
-----------------

[](#service-reference)

### ContractService

[](#contractservice)

Contract management service, provides contract creation, update, termination operations.

### InventoryUpdateService

[](#inventoryupdateservice)

Inventory update service, handles inventory increase/decrease, status changes.

### InventorySummaryService

[](#inventorysummaryservice)

Inventory summary service, automatically aggregates daily inventory data.

### InventoryWarningService

[](#inventorywarningservice)

Inventory warning service, detects low inventory and sends notifications.

### PriceManagementService

[](#pricemanagementservice)

Price management service, supports batch price adjustments.

### RoomTypeInventoryService

[](#roomtypeinventoryservice)

Room type inventory service, manages inventory operations for specific room types.

Development Guide
-----------------

[](#development-guide)

### Architecture

[](#architecture)

The bundle follows Domain-Driven Design principles:

- **Entities**: Core business objects (HotelContract, DailyInventory, InventorySummary)
- **Repositories**: Data access layer with optimized queries
- **Services**: Business logic and operations
- **Controllers**: EasyAdmin integration and API endpoints
- **Commands**: Background tasks and maintenance operations

### Custom Warning Rules

[](#custom-warning-rules)

```
// Extend InventoryWarningService
class CustomInventoryWarningService extends InventoryWarningService
{
    protected function checkWarningCondition(InventorySummary $summary): bool
    {
        // Custom warning conditions
        return $summary->getAvailableRooms() < 5;
    }
}
```

### Batch Operations Example

[](#batch-operations-example)

```
// Batch create inventory
$inventoryService->batchCreateInventory(
    $hotel,
    $roomType,
    $startDate,
    $endDate,
    $quantity
);

// Batch update prices
$priceService->batchUpdatePrices(
    $inventoryIds,
    $costPrice,
    $sellingPrice
);
```

Important Notes &amp; Best Practices
------------------------------------

[](#important-notes--best-practices)

- **Contract Validation**: Date ranges cannot overlap - system enforces automatic validation
- **Data Integrity**: Inventory quantity changes automatically trigger statistics updates
- **Email Configuration**: Warning notifications require proper Symfony Mailer configuration
- **Performance**: Schedule batch operations during low-traffic periods
- **Maintenance**: Run regular inventory synchronization tasks via cron jobs
- **Bundle Dependencies**: Requires hotel-profile-bundle for hotel entity integration
- **Database Transactions**: Ensure proper database transaction handling
- **Monitoring**: Monitor inventory warning notifications for timely response

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md) for version update history.

Contributing
------------

[](#contributing)

Issues and Pull Requests welcome. Please ensure:

1. Code follows PSR-12 coding standards
2. All tests must pass
3. New features require corresponding tests
4. Update relevant documentation

License
-------

[](#license)

This project is licensed under the MIT License. See [LICENSE](LICENSE) file for details.

Authors
-------

[](#authors)

- Tourze Team

References
----------

[](#references)

- [Symfony Console Documentation](https://symfony.com/doc/current/console.html)
- [Doctrine ORM Documentation](https://www.doctrine-project.org/projects/orm.html)
- [EasyAdmin Documentation](https://symfony.com/bundles/EasyAdminBundle/current/index.html)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance72

Regular maintenance activity

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 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 ~58 days

Total

4

Last Release

175d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e354fdb316da535dfa8ba2e9193a473c403b6bc6fb9170778d1dc50e304c6e9d?d=identicon)[tourze](/maintainers/tourze)

---

Top Contributors

[![tourze](https://avatars.githubusercontent.com/u/13899502?v=4)](https://github.com/tourze "tourze (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-hotel-contract-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-hotel-contract-bundle/health.svg)](https://phpackages.com/packages/tourze-hotel-contract-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M648](/packages/sylius-sylius)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)

PHPackages © 2026

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