waaseyaa/groups
Composer 安装命令:
composer require waaseyaa/groups
包简介
Multi-bundle Group content entity type for Waaseyaa (group + group_type; app-defined bundles)
README 文档
README
Layer 2 — Content Types
Multi-bundle group content entity type for Waaseyaa applications. The package defines two entity types — group (the bundle-aware content entity, keyed by gid/uuid, labeled by name, partitioned by type) and group_type (the config entity that declares bundle identities) — and ships with zero pre-registered bundles and zero bundle-scoped fields. Consuming applications declare their own GroupType bundles and register bundle-scoped fields; those field values land in per-bundle subtables named group__{bundle}, while the core keys plus the FieldStorage::Data universals (status, created_at, updated_at) live on the base group table. The package is framework-agnostic: it targets no single product domain. See docs/specs/bundle-scoped-storage.md.
API exposure
group and group_type deliberately opt in to the generic JSON:API surface
and appear in authenticated API discovery. GroupAccessPolicy gates create,
view, update, and delete operations on both types with the administer groups
permission. Accounts without that permission receive no grant from the groups
package policy and are denied for those operations.
Install
Ships as part of waaseyaa/framework — consumers of the metapackage already have it. To depend on it directly:
composer require waaseyaa/groups
The GroupsServiceProvider is auto-discovered via extra.waaseyaa.providers; no manual wiring is required.
Key API
Group (extends ContentEntityBase)
The group content entity. Entity keys: id -> gid, uuid, bundle -> type, label -> name, langcode.
public function __construct( array $values = [], string $entityTypeId = '', array $entityKeys = [], array $fieldDefinitions = [], ); public function getName(): string; // alias for label() public function setName(string $name): static; public function getGroupTypeId(): string; // the group_type bundle id (bundle())
GroupType (extends ConfigEntityBase)
Config entity declaring a single bundle (e.g. 'business', 'organization'). Holds bundle identity plus a description; bundle-scoped field definitions are registered separately. Entity keys: id, label.
public function __construct(array $values = [], string $entityTypeId = '', array $entityKeys = []); public function getLabel(): string; public function getDescription(): string; public function setDescription(string $description): static;
GroupsServiceProvider (extends ServiceProvider)
Registers the group content entity type (via EntityType::fromClass) and the group_type config entity type.
public function register(): void;
Register bundle-scoped fields against the group entity type through the framework's EntityTypeManager:
public function addBundleFields(string $entityTypeId, string $bundle, array $fields): void;
Usage
Declare a bundle's fields, then create and persist a group in that bundle. Bundle-scoped values route to group__{bundle} automatically.
// 1. Register fields for the 'business' bundle (grounded in TwoBundleCoexistenceTest). $entityTypeManager->addBundleFields('group', 'business', [ new FieldDefinition( name: 'email', type: 'string', targetEntityTypeId: 'group', targetBundle: 'business', ), ]); // 2. Materialize the schema (creates `group` + `group__business`). // The framework runs this on the next install / schema pass. // 3. Create and save a group in that bundle. $group = $storage->create([ 'uuid' => 'a1b2...', 'type' => 'business', 'name' => 'Acme Co.', 'langcode' => 'en', 'email' => 'hello@acme.example', ]); $storage->save($group); $loaded = $storage->load($group->id()); $loaded->get('email'); // 'hello@acme.example' — merged back from group__business
Querying a field that exists in more than one bundle without a type constraint raises BundleAmbiguousFieldException — narrow with ->condition('type', 'business'). Registered-but-unmaterialized bundle subtables are reported by waaseyaa health:check as MISSING_BUNDLE_SUBTABLE.
Key classes: Group, GroupType, GroupsServiceProvider.
waaseyaa/groups 适用场景与选型建议
waaseyaa/groups 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.01k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 waaseyaa/groups 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 waaseyaa/groups 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 waaseyaa/groups 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This module allows drag & drop grouping of items in a GridField
Adds text size controls and text-to-speech controls to Flarum discussion content.
Native Blade date, datetime, and date range pickers.
Symfony and Flysystem integration for the maintained KCFinder continuation.
Laravel integration for the maintained KCFinder continuation.
PHPStan rules shared across KnpLabs organization projects
统计信息
- 总下载量: 2.01k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 36
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2026-04-19