sightpress / module-interface
Module contracts for SightPress, a powerful CMS for everyone, designed with blind and low-vision creators and audiences in mind. Interfaces and value objects only, written in modern, object-oriented PHP.
Requires
- php: >=8.5
- psr/container: ^2
- psr/http-message: ^1.1 || ^2
- psr/http-server-handler: ^1
- psr/http-server-middleware: ^1
Requires (Dev)
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-27 23:33:26 UTC
README
The contracts that every SightPress module implements. SightPress is a powerful CMS for everyone, designed with blind and low-vision creators and audiences in mind, built on modern, object-oriented PHP.
This package holds interfaces and small value objects only. It contains no implementation code and depends only on PSR interfaces. SightPress's own features are built as modules on these contracts, and third-party modules use the same contracts.
It is versioned on its own, with strict semantic versioning: a new major version means a breaking change in a contract.
What's in it
ModuleInterface: what every module implements:manifest()andregister(ModuleRegistrar $registrar).ModuleManifestandModuleRequirement: the module's id, version, the modules it needs, and whether it is always on or on by default for new sites.ModuleRegistrar: one typed sub-registrar per kind of addition:services(),routes(),blockTypes(),permissions(),migrations(),adminMenu(),views(),subscribers(),commands(),settings(),search(),dashboard(),assistant(),seo(),sms(),schedule(),translations(),privacy()andplaceholders().Block\BlockType: a content block with its schema, HTML and Markdown rendering, optional structured data and its accessibility checks (A11yRule,A11yIssue).Search\*: site search. Modules turn their content intoSearchDocuments with aSearchDocumentProvider; aSearchBackendindexes them and answers aSearchQuerywithSearchResults, never showing members-only documents to anonymous visitors. Core dispatches aSearchPerformedevent after each search.Dashboard\DashboardWidget: a box on the admin dashboard, shown only to people with its permission.Assistant\*: the optional AI assistant (off by default, bring your own key). AnAssistantProviderturns anAssistantRequestinto anAssistantResponse(StreamingAssistantProvidercan also stream it); anAssistantTaskwrites the prompt and checks the answer, which is only ever anAssistantSuggestionthat a person inserts, copies or discards. Failures throwException\AssistantExceptionwith anAssistantFailure.Event\*: the stable list of events core dispatches (pages, media, menus, accounts, roles, settings, modules, themes …). They carry ids and plain values, never core objects, so modules can listen to them without depending on core.Http\Screens,Http\AdminScreen,Http\PublicScreen,Text\Message: render a module's admin screens and public pages inside the admin panel or the site's theme, with translated titles and notices.Access\Viewer,Site\SiteInfo,Setting\SettingValues,Audit\AuditTrail: who is asking, which site, the site's settings, and the audit log.Seo\SeoProviderandSeo\SeoEntry: a module's public pages in the sitemap,llms.txtand JSON-LD.Schedule\ScheduledJob: background work done byschedule:run.Block\StyledBlockType,BlockStyles,BlockVariant,BlockOption,BlockIcon: style variants, shared options (alignment, background, width, spacing, form layout) and icons.Sms\*: optional text messages. AnSmsProvidersends anSmsMessageto aPhoneNumber(E.164, masked everywhere) and looks numbers up;SmsWebhooksreads delivery receipts and STOP replies. Failures throwException\SmsExceptionwith anSmsFailure.Privacy\*: what a module keeps about people. APersonalDataProviderper data set describes it (PersonalDataSet: purpose, categories, suggested lawful basis,Retention,ErasureRule), exports a person's records and erases them (UserRefin,ErasureResultcounts out);#[PersonalData]marks the fields.CookieDeclarationlists cookies and browser storage, aProcessorSourcenames the third parties data goes to while a feature is configured (ProcessorDeclaration), andConsentManager/ConsentPurposehandle consent. EventsUserDataExported,UserErasureScheduled,UserErasureCancelledandUserErased.Placeholder\*: details editors can put in text ({{ acme_events.next_date }}), with aPlaceholderResolver.Block\CodeLanguage,CodeHighlighter,CodeToken: extra languages for thecodeblock.Locale\LocaleFormats,Money\Money+MoneyFormatter,Site\SiteLanguages: dates, numbers and calendar names in the format locale, money by its own currency, and whether the site has more than one language.- Value objects:
Routing\Route(with an optionalpermissionthat core checks and acriticalflag for two-step confirmation),Access\Permission,Admin\AdminMenuItem,Setting\Setting,Console\CommandParameter; plusMigration\MigrationProviderand theConsole\Commandcontract.
Access\Permission::$allowedOnSignUp (default false) marks the permissions that a role given to people who
register themselves may hold, so sign-up can never grant admin rights.
The value objects check their values when they are built and throw Exception\InvalidValueException with a
message that names the field and the rule.
Interfaces that modules implement change only in a major release. Interfaces that core implements (the registrars,
Block\BlockContext, Console\CommandInput, Console\CommandOutput, Dashboard\DashboardContext,
Assistant\AssistantContext, Http\Screens, Setting\SettingValues, Audit\AuditTrail,
Privacy\ConsentManager, Placeholder\PlaceholderContext, Locale\LocaleFormats, Money\MoneyFormatter and
Site\SiteLanguages) may gain methods in a minor release, so modules must not implement them.
Requirements
- PHP 8.5 or later
psr/container,psr/http-server-handlerandpsr/http-server-middleware
Development
This package has no dependencies on the other SightPress repos. To work on it:
composer install composer check
Composer commands:
composer check: everything that must pass before a commit. It validatescomposer.json, checks the code style, runs static analysis, runs the unit suite with the coverage gate, then runs the integration suite.composer test: both test suites.composer test:unitandcomposer test:integrationrun one suite each.composer test:coverage: the unit suite with coverage. It fails if unit tests cover less than 100% of the lines or methods insrc/, and it lists what is not covered.@codeCoverageIgnoreis not allowed. The HTML report is written tobuild/coverage/html/.composer fix: applies Rector refactorings, then fixes the code style.
Coverage needs the PCOV extension, or Xdebug in coverage mode. If your PHP has neither, use the
development image from the core repo (docker/dev-php/), which has
PHP 8.5, PCOV and Composer. With core cloned next to this repo, run this from this folder:
docker build -t sightpress/dev-php:8.5 ../core/docker/dev-php docker run --rm --user "$(id -u):$(id -g)" -e HOME=/tmp -v "$PWD:/workspace" -w /workspace \ sightpress/dev-php:8.5 composer check
Continuous integration
Every pull request and every push to main runs the CI workflow (composer check): composer validate, code
style, PHPStan, the unit suite with the 100% coverage gate, the integration suite and composer audit. The
coverage report is uploaded as an artifact.
Commit messages follow Conventional Commits; release-please uses them to
keep a release pull request and CHANGELOG.md up to date.
main is protected by the ruleset in .github/rulesets/main.json. Changes reach it only through a pull request that
passes the composer check check and has one approval. Pull requests are squash-merged. Admins can bypass the ruleset.
Contributing
Everyone can help, not only developers. See CONTRIBUTING.md for the ways to take part, and the Code of Conduct that everyone who takes part agrees to follow.
Licence
GNU General Public License v3.0 or later. See LICENSE.