PHPackages                             tourze/biz-organization-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. [Admin Panels](/categories/admin)
4. /
5. tourze/biz-organization-bundle

ActiveSymfony-bundle[Admin Panels](/categories/admin)

tourze/biz-organization-bundle
==============================

多级组织管理模块

1.0.2(5mo ago)00MITPHPCI passing

Since Nov 5Pushed 4mo agoCompare

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

READMEChangelog (3)Dependencies (47)Versions (4)Used By (0)

BizOrganizationBundle
=====================

[](#bizorganizationbundle)

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

多级组织管理模块，支持树形结构的组织架构管理。

功能特性
----

[](#功能特性)

- ✅ 多级组织树形结构
- ✅ 组织负责人关联
- ✅ 灵活的组织查询（按层级、名称、编码等）
- ✅ 完整的 CRUD 管理界面（基于 EasyAdmin）
- ✅ 组织统计信息
- ✅ 数据验证和约束
- ✅ 完整的单元测试覆盖

核心组件
----

[](#核心组件)

### 实体类

[](#实体类)

- `Organization` - 组织实体，支持自引用的树形结构

### 服务类

[](#服务类)

- `OrganizationService` - 组织业务逻辑服务
- `OrganizationRepository` - 组织数据访问层

### 管理界面

[](#管理界面)

- `OrganizationCrudController` - EasyAdmin 管理界面

数据模型
----

[](#数据模型)

### Organization 实体字段

[](#organization-实体字段)

字段类型描述idint主键IDnamestring组织名称（必填）descriptionstring组织描述codestring组织编码（唯一）sortOrderint排序顺序isEnabledbool启用状态parentOrganization上级组织（自引用）childrenCollection下级组织集合managerUserInterface组织负责人phonestring联系电话addressstring办公地址基础用法
----

[](#基础用法)

### 创建组织

[](#创建组织)

```
use BizOrganizationBundle\Service\OrganizationService;

$organizationService = $container->get(OrganizationService::class);

// 创建根组织
$rootOrg = $organizationService->createOrganization(
    '总公司',
    '公司总部',
    'ROOT'
);

// 创建子组织
$techDept = $organizationService->createOrganization(
    '技术部',
    '负责技术研发',
    'TECH',
    $rootOrg // 父组织
);
```

### 查询组织

[](#查询组织)

```
use BizOrganizationBundle\Repository\OrganizationRepository;

$organizationRepo = $container->get(OrganizationRepository::class);

// 获取所有根组织
$rootOrganizations = $organizationRepo->findRootOrganizations();

// 获取组织树结构
$tree = $organizationRepo->findTreeStructure();

// 按编码查找
$org = $organizationRepo->findByCode('TECH');

// 按层级查找
$level1Orgs = $organizationRepo->findByLevel(1);
```

### 组织关系操作

[](#组织关系操作)

```
// 获取组织路径
$path = $organizationService->getOrganizationPath($organization);

// 获取所有下级组织
$subordinates = $organizationService->getAllSubordinateOrganizations($organization);

// 检查祖先关系
$isAncestor = $organizationService->isAncestor($parentOrg, $childOrg);

// 查找共同祖先
$commonAncestor = $organizationService->findCommonAncestor($org1, $org2);
```

安装配置
----

[](#安装配置)

1. 在主项目的 `bundles.php` 中注册 Bundle：

```
return [
    // ... 其他 bundles
    BizOrganizationBundle\BizOrganizationBundle::class => ['all' => true],
];
```

2. 运行数据库迁移：

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

3. （可选）加载测试数据：

```
php bin/console doctrine:fixtures:load --append
```

管理界面
----

[](#管理界面-1)

通过 EasyAdmin 提供完整的管理界面：

- 组织列表：支持搜索、排序、分页
- 组织详情：显示完整的组织信息和关系
- 组织编辑：可视化的表单编辑
- 权限控制：支持基于角色的访问控制

依赖要求
----

[](#依赖要求)

- PHP 8.1+
- Symfony 7.3+
- Doctrine ORM 3.0+
- EasyAdmin Bundle 4+
- tourze/biz-user-bundle 0.0.\*

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance72

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

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

Total

3

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-biz-organization-bundle/health.svg)

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

###  Alternatives

[sylius/sylius

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

8.4k5.6M651](/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.4k](/packages/contao-core-bundle)[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)[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)
