portrino / cms-observer-client-craftcms
Reports the Craft CMS, PHP and database versions plus all plugins to a CMS Observer instance.
Package info
github.com/portrino/cms-observer-client-craftcms
Type:craft-plugin
pkg:composer/portrino/cms-observer-client-craftcms
Requires
- php: ^8.2
- craftcms/cms: ^5.0
- guzzlehttp/guzzle: ^7.2
- psr/http-message: ^1.1 || ^2.0
- yiisoft/yii2: ^2.0.48
Requires (Dev)
- craftcms/phpstan: dev-main
- ergebnis/composer-normalize: ^2.30
- friendsofphp/php-cs-fixer: ^3.14
- guzzlehttp/psr7: ^2.0
- phpstan/phpstan: ^2.0
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^11.5
- rector/rector: ^2.0
- seld/jsonlint: ^1.9
- shipmonk/composer-dependency-analyser: ^1.8
- spaze/phpstan-disallowed-calls: ^4.0
- symfony/yaml: ^6.4 || ^7.0
- tomasvotruba/cognitive-complexity: ^1.0
- tomasvotruba/type-coverage: ^2.0
- typo3/coding-standards: ^0.8 || ^0.9
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
This plugin reports a site's Craft CMS version, PHP + DB versions, and installed plugin versions to a central CMS Observer instance, which flags insecure and outdated versions.
Important
Without a central CMS Observer instance this plugin is somewhat useless. So set up your central CMS Observer instance first and then connect any number of Craft CMS sites by using this client.
Needs a CMS Observer with Craft CMS support (0.14.0 or newer). Craft CMS 4 is end of life and not supported.
All Composer-installed plugins are reported, enabled or not, with their Composer package name, which the Observer looks up on Packagist. License keys are never sent.
🔥 Installation
Composer
Run the following commands within your Craft CMS project:
composer require portrino/cms-observer-client-craftcms php craft plugin/install cms-observer-client
🔧 Configuration
- On the Observer, register a new site with the type
craft(using command line or web interface) and copy the printed token:php bin/console app:site:create "<name>" craft "<site-url>" - Set the environment variables, e.g. in the project's
.env:CMS_OBSERVER_API_URL– the Observer's base URL, must usehttps://CMS_OBSERVER_TOKEN– the token from step 1
Tip
Set the token per environment and give staging its own site on the Observer (or no token at all). Otherwise a
staging copy, e.g. one whose cron job came along with the production setup, reports as production. As a safety net
the client sends the domains of all sites (domains), and the Observer rejects a report with HTTP 409 when none
matches the registered site URL. That only helps if staging has its own domain. The report also sends the Craft
environment (CRAFT_ENVIRONMENT) as applicationContext.
🚀 Run
Send the report once a day via system cron:
php craft cms-observer-client/push
To check what would be sent without sending it:
php craft cms-observer-client/push --dry-run
💎 Credits
This project is the Craft CMS counterpart of the TYPO3 extension cms-observer-client-typo3 and the WordPress plugin cms-observer-client-wordpress.
🧑💻 Contributing
Please have a look at CONTRIBUTING.md.