Download the PHP package hyperf-apex/core without Composer

On this page you can find all versions of the php package hyperf-apex/core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package core

hyperf-apex/core

Hyperf 3.2 + Swoole 6.2 的通用基础底座:请求 DTO 参数水合与校验、统一响应信封、声明式访问控制、 声明式限流与幂等、统一异常、日志通道、Fail-Fast 启动检查、仓储与分页基类。

安装

发布配置

文件 用途
access_log.php 访问日志的排除名单(不跟随指标埋点)
cors.php 跨域允许的来源与请求头
integration.php 集成调用凭证(#[IntegrationAccess] 校验用)
request_exception_snapshot.php 未预期异常的请求快照(默认关)
response.php 响应信封 DTO 与额外转换器(必配,见下)
security.php 启动期访问声明检查开关
sql_log.php SQL 日志量级(全量 / 慢查询 / 写操作)
startup_checks.php 启动期必填配置项与环境变量

配置项

键 环境变量(默认值) 说明
access_log.exclude ACCESS_LOG_EXCLUDE_PATHS(/metrics/*) 逗号分隔的路径通配;5xx 与异常请求照旧留痕
cors.allowed_origins CORS_ALLOWED_ORIGINS(*) 允许的来源
cors.allowed_headers CORS_ALLOWED_HEADERS(空) 额外的允许请求头
integration.integration_token INTEGRATION_TOKEN(空) 集成凭证;空值时中间件直接拒绝,不会放行
request_exception_snapshot.enabled REQUEST_EXCEPTION_SNAPSHOT_ENABLED(false) 是否给未预期异常留请求快照
request_exception_snapshot.whitelist / blacklist 同名环境变量 路径通配;先黑后白,白名单非空时只有命中才留痕
request_exception_snapshot.max_length REQUEST_EXCEPTION_SNAPSHOT_MAX_LENGTH(8192) 快照正文上限(字节,按 mb_strcut 截断)
response.response_dto — 响应信封 DTO 的类名,必须实现 ApiResponseInterface
response.response_transformers — 额外的响应转换器
security.declaration_check.enabled SECURITY_DECLARATION_CHECK(true) 端点访问声明检查;关掉时漏声明会静默通过
sql_log.full SQL_LOG_FULL(非生产默认 true) 是否记录全量 SQL
sql_log.slow_ms SQL_LOG_SLOW_MS(200) 慢查询阈值(毫秒),<= 0 表示不按耗时记录
sql_log.writes SQL_LOG_WRITES(true) 是否记录写操作
startup_checks.required — 必填配置项规则数组(path / env / hint)
startup_checks.required_envs — 必填环境变量规则数组
startup_checks.checkers — 自定义检查器(实现 CheckerInterface)

主要能力与入口

能力 入口
请求 DTO 与参数水合 Hyperf\Apex\DTO\AbstractDTO + #[FromQuery] / #[FromBody] / #[FromMultipart]
字段约束(校验 + 文档同时生效) #[Length]、#[In]、#[ArrayOf]、#[MapOf]、#[EnumValue] 等;只进文档的约束实现了 DocumentationOnlyAttribute
统一响应信封 ApiResponseDTO、ApiResponseInterface、ApiResponseTransformer
访问声明与权限 #[PublicAccess] / #[IntegrationAccess] / #[ApiKeyAccess] / #[Authenticated]、#[RequirePermission]、#[RequireRole]、AccessDeclarationReader、Principal、PermissionSet
限流与幂等声明(实现在 reliability) #[RateLimit]、#[Idempotent]
统一异常 BusinessException、ErrorCode、AppExceptionHandler
日志通道 Hyperf\Apex\Logging\LoggerChannels::resolve()
启动检查 StartupChecker + CheckerInterface
数据访问 AbstractRepository(含 paginate())、AbstractModel(create_time / update_time / delete_time)
时间 Hyperf\Apex\Support\Time::now()
命令 php bin/hyperf.php schema:model-check

用法

请求 DTO 与控制器(取值来源必须显式声明,漏标会在请求时报错而不是静默注入空 DTO):

需要自行实现的契约

契约 什么时候要
Hyperf\Apex\Http\Response\Contract\ApiResponseInterface 自定义响应信封 DTO(需实现 code())
Hyperf\Apex\Diagnostics\Contract\CheckerInterface 自定义启动检查项

边界


All versions of core with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hyperf-apex/core contains the following files

Loading the files please wait ...