定制 componenta/policy-app 二次开发

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

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

componenta/policy-app

Composer 安装命令:

composer require componenta/policy-app

包简介

Componenta application integration for policy cache compilation

README 文档

README

Application-level compile integration for componenta/policy. This package turns policy attributes into serializable descriptors that can be loaded from production cache by the runtime policy provider.

Use it in a Componenta application cache build. Runtime code that only evaluates policies should depend on componenta/policy.

Installation

composer require componenta/policy-app

The package declares Componenta\Policy\App\ConfigProvider in extra.componenta.config-providers. When componenta/composer-plugin is installed, the provider is added to the generated provider list automatically.

Related Packages

Package Why it matters here
componenta/policy Enforces policies and consumes compiled policy descriptors.
componenta/class-finder Finds classes and public methods with policy attributes.
componenta/app Runs the compiler only when policy support is installed and bound.

What It Adds

The package provides Componenta\Policy\App\Compile\PolicyMapCompiler.

The compiler scans discovered classes for policy attributes on:

  • classes
  • public methods

It returns a descriptor map keyed by action id. CompiledPolicyProvider from componenta/policy consumes those descriptors at runtime.

Development Mode

In development, policy metadata may be read through reflection or rebuilt during cache warmup. This is useful while classes and attributes are changing.

Production Mode

In production, the application should load compiled descriptors instead of scanning source files. This keeps request startup deterministic and avoids repeated reflection over command/query/controller classes.

The compiler should be enabled only when componenta/policy is installed and a policy provider binding exists. componenta/app performs that feature gating through compile support.

Failure Behavior

Runtime policy enforcement stays in componenta/policy. If a compiled descriptor is stale or malformed, the runtime provider handles that as a runtime policy concern. The app package only produces the descriptor map.

Boundaries

componenta/policy-app must not contain authorization decisions. Policy contracts, attributes, providers, policy composition, and enforcement belong to componenta/policy; this package owns only application compile integration.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固