dvsa / mot-cpms-common
Contains common code shared by CPMS projects
Requires
- php: ^8.2
- dvsa/mot-logger: ^3.3.1
- laminas-api-tools/api-tools-versioning: ^1.4
- laminas/laminas-authentication: ^2.8
- laminas/laminas-dependency-plugin: ^2.6.0
- laminas/laminas-inputfilter: ^2.12
- laminas/laminas-json: ^3.3
- laminas/laminas-mvc: ^3.3.0
- laminas/laminas-router: ^3.4
- laminas/laminas-servicemanager: ^3.7
Requires (Dev)
- captainhook/captainhook: ^5.16
- captainhook/plugin-composer: ^5.3
- dvsa/coding-standards: ^2.1
- friendsofphp/php-cs-fixer: ^3.95
- laminas/laminas-component-installer: ^3.4.0
- laminas/laminas-test: ^4.0.0
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^4.0.2.0
- vimeo/psalm: ^6.13
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v3.0.2
- v3.0.1
- v3.0.0
- v2.0.0
- v1.1.0
- v1.0.0
- dev-feature-bl-22948-update-mot-logger-version
- dev-feature-bl-22065-update-cpms-queues-arbitary-code-injection
- dev-feature-bl-15043-linting-and-static-analysis-shruti
- dev-feature-bl-17035-php-82-update
- dev-feature-BL-15591-update-cpms-php-81
- dev-fix-phpcs-misconfiguration
- dev-chore-update-php-version-matrix-on-security-and-test-workflows
This package is auto-updated.
Last update: 2026-10-16 12:08:41 UTC
README
CPMS service for MOT Testing application
Installing
The recommended way to install is through Composer.
composer require dvsa/mot-cpms-common
Logging Configuration
This module uses mot-logger v3.3.1. Logging is configured via the named
loggers structure under the mot_logger config key, introduced in BL-22896.
See the MOT Logger repository for the full
configuration reference.
Named logger
The module's default configuration in config/module.config.php defines a named
logger mot-cpms-common (the repository name — not default):
'mot_logger' => [ 'loggers' => [ 'mot-cpms-common' => [ 'channel' => 'cpms-common', 'writers' => [ 'stderr' => [ 'type' => 'stream', 'path' => 'php://stderr', 'formatter' => 'pipe', 'level' => 'error', 'enabled' => true, ], 'file' => [ 'type' => 'stream', 'path' => '/var/log/dvsa/' . \date('Y-m-d') . '-cpms-common.log', 'formatter' => 'json', 'level' => 'error', 'enabled' => true, ], ], ], ], ],
- Channel:
cpms-common— preserved from the previousloggerconfiguration - stderr writer: pipe-delimited output to
php://stderraterrorlevel and above - file writer: JSON output to
/var/log/dvsa/{YYYY-MM-DD}-cpms-common.logaterrorlevel and above
Consuming applications can override any part of this configuration in their own
config/autoload/*.php files, e.g. to change the file path, level or disable a
writer. Writers are keyed (stderr, file) so individual entries can be
overridden or disabled:
'mot_logger' => [ 'loggers' => [ 'mot-cpms-common' => [ 'writers' => [ 'file' => ['enabled' => false], ], ], ], ],
Custom logger setup
The Logger service (also available via the logger alias) is built by
CpmsCommon\Service\LoggerServiceFactory. The factory delegates to mot-logger's
DvsaLogger\Factory\MotLoggerFactory to build a Monolog instance from the
mot-cpms-common named configuration, then wraps it in
CpmsCommon\Service\LoggerService — a MotLogger subclass adding the
backward-compatible logException() helper used across CPMS code.
Registering the DvsaLogger module (shipped with dvsa/mot-logger) additionally
makes the DvsaLogger\Logger\MotLogger service and on-demand named loggers
(e.g. $container->get('mot-cpms-common')) available via the module's abstract
factory.
Migrating from the legacy logger config
The legacy logger config key (filename/location/channel) is no longer
read. Applications overriding it in their own config should move those overrides
to mot_logger.loggers['mot-cpms-common'] as shown above.
Contributing
Please refer to our Contribution Guide.