studyportals / cms
Studyportals' CMS
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 12 106
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 3
Requires
- doctrine/cache: ~1.10.0
- psr/simple-cache: ~1.0.1
- rollbar/rollbar: ~2.1.0
- studyportals/template4: ~1.0.2
Requires (Dev)
- brainmaestro/composer-git-hooks: ~2.8.3
- mockery/mockery: ~1.3.1
- phpmd/phpmd: ~2.8.2
- phpstan/extension-installer: ~1.0.3
- phpstan/phpstan: ~0.12.11
- phpstan/phpstan-mockery: ~0.12.3
- phpstan/phpstan-phpunit: ~0.12.6
- phpunit/phpunit: ~8.5.2
- roave/security-advisories: dev-master
- slevomat/coding-standard: ~6.1.5
- squizlabs/php_codesniffer: ~3.5.4
This package is auto-updated.
Last update: 2022-01-27 08:39:47 UTC
README
The routing and page compositing framework behind Mastersportal.com et al.
Development
Requires PHP 7.2.
composer install
Test-coverage has been worked up substantially over the past years, but is not yet complete. A broad set of integration-tests is available; many unit-tests are still missing...
composer run phpunit
Apart from PHPUnit, there's full compliance with PHPStan, PSR-12 and a subset of PHPMD:
composer run phpstan composer run phpstan:tests # slightly relaxed for tests/** composer run phpcs composer run phpmd composer run phpmd:tests # slightly (more) relaxed for tests/**
Git-hooks
This project uses composer-git-hooks to enable the following Git-hooks:
pre-push
– run all of the tests listed above.checkout
– upon switching branches, run an auto-update script and check if the repository is still in-sync with repo-template-php.pre-commit
– prevent committing directly in themaster
- anddevelop
-branches; use pull-requests instead.
Using the CMS
With exception of the single code-snippet below, no documentation is available as of yet... 😇
The routing logic (e.g. translating path/to/a/page.html
to the actual page to
be displayed) is part of the CMS. Each individual implementation has to provide
its own logic to handle the broader environment though. Things such as picking
up signals from the HTTP-server, gracefully handling error conditions, issuing
HTTP-redirects and managing client-side caching behaviour are not managed by the
CMS.
The most basic implementation of the CMS looks something like this:
$site = $this->siteHandler->createSite(); $this->templateHandler->initTemplate($site); // Set page according to virtual-path (e.g. via Apache RewriteRules) $virtual_path = trim( $this->inputHandler->get(INPUT_GET, 'virtual_path') ?? '' ); $site->getPageTree()->setPageByPath($virtual_path); // Show page echo (string) $site->getPage()->display();
Origins of the CMS
The CMS traces its origins back to around 2004. It has been powering Mastersportal.com (and its predecessor MastersPortal.eu) since mid-2007.
It started out as a fully fledged Content Management System (hence its name and that of many of its components), but over the years evolved into the routing and page compositing framework it currently is.
Notable features that got removed over the years:
- A drag-and-drop WYSIWYG administrative interface allowing for on the fly modifictions of the site, with configuration stored in an SQL-database – replaced with a static page-tree defined using PHP classes.
- Multi-language support (via the
Accept-Language
-header) including an interactive WYSIWYG editor enabling all static interface elements to be translated in situ – the sheer complexity of this approach never matched any of its returns; given the current structure of CMS, a simpler and equally effective approach can be constructed on top of this package. - A dynamic (i.e. runtime) asset "packer", reducing a multitude of JavaScript- and CSS-files to a limited set of asset "packs" (both site-wide and at the level of individual pages) – replaced by a Webpack-powered build-process (not part of this repository).
Notable contributors over the years: