定制 waaseyaa/graphql 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

waaseyaa/graphql

Composer 安装命令:

composer require waaseyaa/graphql

包简介

GraphQL endpoint + schema introspection for Waaseyaa — optional/experimental L6 surface; see README for the primary JSON:API framing.

README 文档

README

Alternative protocol — not the primary API surface.

Per the framework's API-surface consolidation (mission api-surface-consolidation-jsonapi-primary-01KSEFTV), the framework's primary API surface is JSON:API in packages/api/. waaseyaa/graphql remains supported as an optional / experimental L6 protocol adapter for distributions whose consumers need GraphQL. It is not bundled by waaseyaa/full; install it explicitly when your distribution chooses GraphQL.

Layer 6 — Interfaces

GraphQL endpoint for Waaseyaa with auto-generated schema from registered entity types.

GraphQlEndpoint accepts queries at the configured route (registered via GraphQlRouteProvider) and resolves them against EntityTypeManagerInterface-derived schemas. Connection-style pagination follows the Relay spec: totalCount reflects the full unfiltered dataset (matching JSON:API semantics — see #436), while items returns only the access-filtered subset. Field resolvers honour FieldAccessPolicyInterface so attribute-level access control matches the JSON:API surface.

Key classes: GraphQlEndpoint, GraphQlRouteProvider, GraphQlServiceProvider.

Status

  • Stability: optional / experimental. The public API surface (GraphQlServiceProvider, the /graphql endpoint, the schema-loading mechanism, any documented resolvers / mutations) is frozen at its current shape. The framework cadence ships no new feature work for this package; community contributions are accepted under the same review bar.
  • Bundle membership: suggested by waaseyaa/full (not required). To install: composer require waaseyaa/graphql.
  • Decision provenance: API-surface consolidation by mission api-surface-consolidation-jsonapi-primary-01KSEFTV. JSON:API is declared the framework's primary API surface in docs/specs/jsonapi.md.

Implementation gotchas

  • Reference fields keep storage field names: A field defined as author_id with type entity_reference produces a GraphQL field named author_id (not author). It resolves to the nested entity object but the field name includes the _id suffix.
  • List filter/sort fields are gated through field-level access (R14, audit A11): EntityResolver::resolveList() applies caller-supplied filter/sort arguments as raw storage conditions. Previously total and items were gated only by the entity-level guard->canView() predicate, so a field restricted per row by a dynamic FieldAccessPolicy (a classification/clearance field) was a presence/ordering oracle: filtering filter: [{field: "classification_field", value: "secret"}] returned that value's row count even though the caller could not read the field. resolveList() now excludes a row from BOTH the count loop and the item loop when any caller-supplied filter/sort field is view-Forbidden for it (GraphQlAccessGuard::isFieldViewForbidden()), value-independently (dropped because the caller may not READ the queried field, never because of its value), matching the REST JsonApiController::index() fix. Because QueryApplier runs sort+pagination in storage before that drop, a sort on a field view-Forbidden on any viewable matched row is additionally REJECTED (EntityResolver::rejectForbiddenSort() throws a UserError), so a Forbidden row can never occupy an observable pagination rank (the empty-vs-populated-page ordering oracle). Gated to the bound-account path; the system-context bypass keeps the raw storage COUNT. Structural allowlist (R15, audit A11): the residual the R14 entry flagged is now closed — EntityResolver::assertQueryableFields() runs at the top of resolveList() (before any storage query, unconditionally) and throws a UserError for any filter/sort field that is not a declared field or entity key, is in ALWAYS_INTERNAL_FIELDS (pass/password/password_hash), or is a declared field flagged settings['internal'] => true. This mirrors REST's JsonApiController::validateQueryFields() and closes the undeclared-_data-key oracle (which reached json_extract('$.<field>')) and the internal-flagged-secret oracle (e.g. User.two_factor_secret), both of which R14's per-policy gate could not see. See docs/specs/api-layer.md "Field-access gate on filter/sort fields (audit R14)". Pinned by EntityResolverFieldFilterOracleTest (R14) and EntityResolverStructuralFieldAllowlistTest (R15).
  • Mutations require an authenticated account (R11): GraphQlEndpoint::handle() rejects any mutation operation (create{Type}/update{Type}/delete{Type}, any alias or operationName-selected mutation) for an unauthenticated (AccountInterface::isAuthenticated() === false) caller, for every HTTP method, BEFORE building the schema or invoking a resolver: a uniform error message "Authentication required for mutation operations." (no entity id/type ever named) and the mutation never executes. Queries are unaffected. This closes an anonymous existence oracle: update{Type}/delete{Type} distinguished "entity absent" ("Entity not found: {type}/{id}") from "entity exists but access denied", an anonymous or otherwise-unauthorized caller could enumerate entity ids by diffing the two messages even though every per-entity AccessPolicyInterface was itself correct. As defense-in-depth for the authenticated-but-unauthorized case (not blocked by the gate above), EntityResolver::resolveUpdate()/resolveDelete() collapse an access-denied outcome, at BOTH the entity level AND the per-field edit level (the assertFieldEditAccess() loop is inside the collapse), into the SAME "Entity not found" error the absent-entity branch throws, mirroring resolveSingle(), which has always returned null uniformly for both cases. GraphQlRouter propagates the endpoint's HTTP status. A custom update/delete resolver registered through withMutationOverrides() replaces the generated resolver and MUST preserve the same absent/access-denied collapse, preferably by delegating to EntityResolver. See docs/specs/api-layer.md for the full writeup.

waaseyaa/graphql 适用场景与选型建议

waaseyaa/graphql 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.92k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 waaseyaa/graphql 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 waaseyaa/graphql 我们能提供哪些服务?
定制开发 / 二次开发

基于 waaseyaa/graphql 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 7.92k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 41
  • 依赖项目数: 1
  • 推荐数: 1

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-03-14