PHPackages                             tourze/delivery-address-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/delivery-address-bundle

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

tourze/delivery-address-bundle
==============================

收货地址管理（实体+JSON-RPC Procedure）

1.1.0(4mo ago)0461MITPHPCI passing

Since Nov 5Pushed 4mo agoCompare

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

READMEChangelog (3)Dependencies (49)Versions (4)Used By (1)

Delivery Address Bundle
=======================

[](#delivery-address-bundle)

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

A Symfony bundle for managing delivery addresses with JSON-RPC Procedures and EasyAdmin integration.

Features
--------

[](#features)

- ✅ Complete delivery address entity management
- 🔌 JSON-RPC procedures for address operations
- 🔐 User-based access control
- ⭐ Default address handling
- 🎨 EasyAdmin CRUD interface
- 🧪 Comprehensive test coverage (238 tests)
- 🌐 Multi-language support (EN/CN)
- 📍 GB/T 2261 administrative division codes support

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

[](#installation)

```
composer require tourze/delivery-address-bundle
```

Configuration
-------------

[](#configuration)

Add the bundle to your `config/bundles.php`:

```
return [
    // ...
    Tourze\DeliveryAddressBundle\DeliveryAddressBundle::class => ['all' => true],
];
```

Run migrations to create the database tables:

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

JSON-RPC Procedures
-------------------

[](#json-rpc-procedures)

### Address Management

[](#address-management)

- `GetDeliveryAddressList` - Get user's address list with pagination
- `GetDeliveryAddressDetail` - Get address details by ID
- `CreateDeliveryAddress` - Create new delivery address
- `UpdateDeliveryAddress` - Update existing address
- `DeleteDeliveryAddress` - Delete address by ID

### Default Address

[](#default-address)

- `SetDefaultDeliveryAddress` - Set address as default
- `GetDefaultDeliveryAddress` - Get user's default address

> **Note**: All procedures require authentication (`IS_AUTHENTICATED_FULLY`)

Entity
------

[](#entity)

### DeliveryAddress

[](#deliveryaddress)

The main entity representing a delivery address:

```
use Tourze\DeliveryAddressBundle\Entity\DeliveryAddress;

// Entity fields:
// - id: Primary key (BIGINT)
// - user: UserInterface relation (owner)
// - sn: Unique snowflake identifier
// - consignee: Recipient name (max 50 chars)
// - mobile: Contact phone number (max 20 chars)
// - country: Country name (optional, max 64 chars)
// - province: Province/state (max 64 chars)
// - provinceCode: Province code (optional, max 20 chars)
// - city: City name (max 64 chars)
// - cityCode: City code (optional, max 20 chars)
// - district: District/county (max 64 chars)
// - districtCode: District code (optional, max 20 chars)
// - addressLine: Detailed address (max 255 chars)
// - postalCode: Postal/ZIP code (optional, max 20 chars)
// - addressTag: Address label like "home", "office" (optional, max 20 chars)
// - gender: Gender enum (optional, using GB/T 2261 standard)
// - isDefault: Default address flag (boolean)
// - createTime/updateTime: Timestamps (auto-managed)
// - createdBy/updatedBy: Blameable tracking
// - createdFromIp/updatedFromIp: IP tracking
```

Repository
----------

[](#repository)

The `DeliveryAddressRepository` provides several query methods:

```
use Tourze\DeliveryAddressBundle\Repository\DeliveryAddressRepository;

// Query by user object
$qb = $repository->buildListQueryByUser($user);

// Query by user identifier (uses UserInterface::getUserIdentifier())
$qb = $repository->buildListQueryByUserId('user123');

// Find default address
$address = $repository->findDefaultByUser($user);
$address = $repository->findDefaultByUserId('user123');

// Unset default for user
$affectedRows = $repository->unsetDefaultForUser($user);
```

> **Important**: The `buildListQueryByUserId()` and `findDefaultByUserId()` methods use `userIdentifier` field (Symfony 6+ standard), not `username`.

Admin Interface
---------------

[](#admin-interface)

The bundle provides an EasyAdmin CRUD controller at `/admin` for address management with:

- List view with filtering and searching
- Form creation and editing
- Batch operations
- User-based data isolation
- Automatic IP and user tracking

Development
-----------

[](#development)

### Running Tests

[](#running-tests)

```
# Run all tests (238 tests)
./vendor/bin/phpunit packages/delivery-address-bundle/tests

# Run specific test suite
./vendor/bin/phpunit packages/delivery-address-bundle/tests/Entity
./vendor/bin/phpunit packages/delivery-address-bundle/tests/Repository
./vendor/bin/phpunit packages/delivery-address-bundle/tests/Procedure
```

### Code Quality

[](#code-quality)

```
# PHPStan static analysis (Level 9)
php -d memory_limit=2G ./vendor/bin/phpstan analyse packages/delivery-address-bundle/src --level=9
```

Architecture
------------

[](#architecture)

### Service Layer

[](#service-layer)

- `DeliveryAddressService`: Business logic layer for address operations
- Handles validation, default address management, and entity lifecycle

### Event Listeners

[](#event-listeners)

- `DeliveryAddressEntityListener`: Doctrine entity lifecycle events
- Automatic field validation and consistency checks

### Data Fixtures

[](#data-fixtures)

- `DeliveryAddressFixtures`: Test data generation for development and testing
- Uses `UserManagerInterface` for user creation

Requirements
------------

[](#requirements)

- PHP 8.1+
- Symfony 7.3+
- Doctrine ORM 3.0+

Dependencies
------------

[](#dependencies)

This bundle requires several other packages from the `tourze/*` ecosystem:

- `tourze/json-rpc-core`: JSON-RPC server infrastructure
- `tourze/doctrine-*-bundle`: Doctrine extensions (timestamps, IP tracking, user tracking, etc.)
- `tourze/easy-admin-*-bundle`: EasyAdmin extensions
- `tourze/user-service-contracts`: User management contracts

See [composer.json](composer.json) for the complete list.

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) file for details.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance74

Regular maintenance activity

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity37

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

Total

3

Last Release

141d 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-delivery-address-bundle/health.svg)

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

###  Alternatives

[sylius/sylius

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

8.4k5.6M648](/packages/sylius-sylius)[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[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)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

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