psfs / nosql
NOSQL package for PSFS
1.0.2
2026-03-25 10:22 UTC
Requires
- php: >=8
- ext-mongodb: *
- mongodb/mongodb: ^2
- psfs/core: ^2
Requires (Dev)
- phpmd/phpmd: @stable
- phpunit/phpunit: ^11
- roave/security-advisories: dev-master
This package is auto-updated.
Last update: 2026-03-25 10:39:54 UTC
README
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 alias2.2.x-dev)ext-mongodbmongodb/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, notAPi). - 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, andallowDiskUse - configurable string filtering mode (
contains|prefix|exact)
- unified query plan for
Query Planner Options
The NOSQL CRUD query layer supports these optional request keys:
__string_mode:contains(default),prefix, orexact__cursor_mode:cursor/seek/afterto 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 installran andvendor/is up to date.
- ensure
- Endpoints not discovered:
- check that
metadata.attributes.enabled=truein effective PSFS configuration.
- check that
- MongoDB extension errors:
- verify
ext-mongodbis enabled in runtime (php -m | grep mongodb).
- verify
- Scrutinizer CI:
- install MongoDB extension using
build.environment.php.pecl_extensions: [mongodb].
- install MongoDB extension using
Migration: annotations -> attributes
For new APIs or code generated by the module:
- Use attributes as the primary metadata source.
- Keep annotations only if temporary compatibility is needed.
- 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.