定制 psfs/nosql 二次开发

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

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

psfs/nosql

最新稳定版本:1.0.2

Composer 安装命令:

composer require psfs/nosql

包简介

NOSQL package for PSFS

README 文档

README

Build Status Scrutinizer Code Quality Code Coverage Packagist Stable Version PHP 8.3

NOSQL module for PSFS, aligned with the psfs/core 2.2.x-dev development line.

Technical Baseline

  • Target runtime: PHP 8.3
  • Main dependencies:
    • psfs/core: dev-master (branch alias 2.2.x-dev)
    • ext-mongodb
    • mongodb/mongodb:^2.1.2
  • Metadata compatibility:
    • PHP 8 attributes as the primary contract
    • Legacy annotations kept temporarily as fallback

Local Development (Docker)

docker compose up -d
docker compose ps

Typical PHP container name: nosql-php-1.

docker exec nosql-php-1 php -v
docker exec nosql-php-1 composer install
docker exec nosql-php-1 php vendor/bin/phpunit -c src/NOSQL/phpunit.xml.dist

Minimum Validation

composer validate --no-check-publish --strict
vendor/bin/phpunit -c src/NOSQL/phpunit.xml.dist

Implemented Upgrade Contracts

  • Routes and metadata in APIs/controllers migrated to attributes:
    • Api, Route, HttpMethod, Injectable, Label, Visible, Action
  • Route convention normalized (Api, not APi).
  • Generator templates updated to emit attributes in newly generated code.
  • PHPUnit configuration migrated to 11.5 schema.
  • GitHub Actions CI added for composer validate + tests.
  • CRUD query planner optimized with:
    • unified query plan for find/count/deleteMany
    • strict custom pipeline whitelist
    • index metadata caching
    • cursor-mode pagination support (seek/after)
    • optional query hint, maxTimeMS, and allowDiskUse
    • configurable string filtering mode (contains|prefix|exact)

Query Planner Options

The NOSQL CRUD query layer supports these optional request keys:

  • __string_mode: contains (default), prefix, or exact
  • __cursor_mode: cursor/seek/after to enable cursor pagination
  • __after: JSON object with sort field values for cursor pagination
  • __hint: index hint (string or object)
  • __maxTimeMS: max execution time for query operations
  • __allowDiskUse: enable disk usage for aggregation if needed
  • __collation: explicit collation object

Automatic index recommendations in syncCollections can be enabled with:

  • nosql.sync.autoIndexes=true

Quick Troubleshooting

  • PSFS autoload/class errors:
    • ensure composer install ran and vendor/ is up to date.
  • Endpoints not discovered:
    • check that metadata.attributes.enabled=true in effective PSFS configuration.
  • MongoDB extension errors:
    • verify ext-mongodb is enabled in runtime (php -m | grep mongodb).
  • Scrutinizer CI:
    • install MongoDB extension using build.environment.php.pecl_extensions: [mongodb].

Migration: annotations -> attributes

For new APIs or code generated by the module:

  1. Use attributes as the primary metadata source.
  2. Keep annotations only if temporary compatibility is needed.
  3. Avoid introducing new routes or methods only in annotation format.

This reduces legacy fallback usage and aligns the module with the current psfs/core contract.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固