Skip to content

MelisCore

The backoffice foundation every other module builds on: login, users/roles/rights, the menu & tool (DataTable) framework, dashboard, config, email, GDPR, and the base service + event system. Package melisplatform/melis-core.

Purpose

MelisCore is the backoffice heart of Melis Platform. It provides the application shell (header, left menu, tools tree, dashboard, footer), the MelisCoreConfig configuration tree that aggregates every module's app.*.php files, authentication and per-tool rights, user management, platform/environment handling, transactional emails, GDPR tooling, a micro-service auth endpoint, and the shared service/event layer that every other module extends. Every melisplatform/* module depends on it.

Enable it

Add to config/modules.config.php:

php
return [
    'MelisCore',
    // … other modules …
];

It must load early — most other modules call its services. Its companion infrastructure modules are MelisAssetManager, MelisDbDeploy, MelisComposerDeploy and MelisInstaller.

Key services

Registered as service_manager aliases in vendor/melisplatform/melis-core/config/module.config.php:

Service aliasRole
MelisCoreConfigRuntime config tree. Reads any aggregated app.* config by path: getItem('/meliscore/interface/…'), getItemPerPlatform('/meliscore/datas/'), getFormMergedAndOrdered(…), setFormFieldRequired(…).
MelisCoreAuthBackoffice authentication (extends Laminas auth). hasIdentity(), getIdentity() (the melis_core_user row), getAuthRights() (rights XML), encryptPassword(), isPasswordCorrect().
MelisCoreRightsPer-tool access control. canAccess($melisKey), isAccessible($xmlRights, $sectionId, $itemId), getRightsValues($id, $isRole), createXmlRightsValues(…), getToolSectionMap().
MelisCoreToolBackoffice tool helper for controllers. setMelisToolKey($plugin, $toolKey), getColumns(), getForm($formKey), getDataTableConfiguration(…), getSearchableColumns().
MelisCoreDispatchChains controller dispatches, accumulating [success, errors, datas] for multi-step saves.
MelisCoreTranslationLoads and merges tr_* interface/form translations per locale.
MelisCoreBOEmailServiceBackoffice email templates: sendBoEmailByCode($code, $tags, $toEmail, $toName, $langId), getBoEmailByCode(), saveBoEmailByCode(), deleteEmail().
MelisCoreEmailSendingServiceLow-level email sender: sendEmail($fromEmail, $fromName, $toEmail, $toName, $replyTo, $subject, $htmlBody, $textBody, $transportConfig).
MelisCoreGdprServiceGDPR subject access/erasure (broadcasts events): getUserInfo(), extractSelected(), deleteSelected().
MelisCoreGdprAutoDeleteServiceScheduled data-retention engine: run(), getFirstAlertUsers(), getSecondAlertUsers(), getSmtpConfigData().
MelisGeneralServiceBase class most platform services extend — provides makeArrayFromParameters(), sendEvent(), getServiceManager().

Backoffice

MelisCore delivers the entire backoffice shell and the System Configuration section of the tools tree, plus:

Tool (melisKey prefix)Purpose
Users (meliscore_tool_user)Create and edit backoffice users; assign roles and per-tool rights; view login history; generate API keys.
PlatformsDeclare environments (dev / staging / production) and set per-platform colour scheme.
LanguagesManage backoffice locales.
Emails managementCreate/edit transactional email templates with per-language body and [TAG] placeholders.
LogsSearchable action log, filterable by type, user and date.
Other configPassword/security policy: expiry, lock threshold, password history.
GDPRSearch a person, view held data, anonymise, configure SMTP for GDPR notifications; separate cron-driven auto-delete engine.
Modules / MarketplaceInstall, update or remove modules and manage the production asset bundle.
AnnouncementsCreate backoffice announcements shown on the dashboard.

Interface tree (app.interface.php) — the backoffice backbone

The entire backoffice — every tool, tab, modal, menu entry — is described as a single nested tree of interface nodes, deep-merged from every module's config/app.interface.php. Each node has:

  • confmelisKey (unique, module-prefixed), DOM id, translation name, icon, rightsDisplay.
  • forward — the controller action that renders the zone (module, controller, action, optional jscallback).
  • interface — child nodes (recursive).

melisKey is the stable identifier used for rights checks, zone reloads and DOM addressing. Rights are stored as an XML tree in melis_core_user.usr_rights; anything not granted is hidden.

Top-level shell branches: meliscore_header, meliscore_leftmenu, meliscore_center, meliscore_footer, and meliscore_toolstree_section (the grouped tools tree).

Tool (DataTable) framework (app.tools.php)

Every list tool is declared in a module's config/app.tools.php and rendered through MelisCoreTool + the MelisDataTable view helper. The declaration covers columns, filters, searchable fields, action buttons, modals and forms.

Event system

MelisGeneralService fires *_start / *_end events around each service method, enabling any module to intercept. Hook via the shared event manager:

php
$sm->get('SharedEventManager')->attach(
    'MelisCore',
    'meliscore_tooluser_savenew_end',
    function ($e) { $p = $e->getParams(); /* react */ },
    100
);

Common core events: meliscore_tooluser_savenew_start/end, …delete_start/end, …save_start/end, melis_core_check_user_rights, meliscore_install_create_new_user, melis_core_new_platform, and the GDPR events (melis_core_gdpr_user_info_event, …_extract_event, …_delete_event, melis_core_gdpr_auto_delete*).

JS helpers

Available globally as melisHelper (public/js/core/melisHelper.js):

zoneReload(melisKey, params), createModal(zoneId, modalKey, …), melisOkNotification(title, msg) / melisKoNotification(…), tabOpen() / tabClose() / tabSwitch(), loadingZone(sel) / removeLoadingZone(sel), melisTinyMCE.createTinyMCE('tool', sel, {}).

Database tables

TableHolds
melis_core_userBackoffice users (login, password hash, usr_rights XML, admin flag, lang, role).
melis_core_user_roleRoles and their urole_rights XML.
melis_core_user_connection_dateLogin history.
melis_core_langBackoffice languages.
melis_core_platformEnvironments/platforms.
melis_core_bo_emails / _detailsTransactional email templates and per-language bodies.
melis_core_log / _log_type / _log_type_transAction log, types and translations.
melis_core_lost_passwordPassword reset tokens.
melis_core_user_connection_datePer-user login history.
melis_core_microservice_authAPI keys for micro-service endpoints.
melis_core_dashboards / _dashboard_schemaPer-user dashboard layout.
melis_core_pluginsRegistered plugins.
melis_core_gdpr_delete_config / _delete_emails_logsGDPR auto-delete rules and audit trail.
melis_user_password_historyPassword history (reuse prevention).
melis_announcementBackoffice announcements.

Example

Send a backoffice email using the template system, check a right, and call a service method with the event pattern:

php
// Send a templated email (B7)
$boEmail = $sm->get('MelisCoreBOEmailService');
$boEmail->sendBoEmailByCode(
    'MYMODULE_WELCOME',
    ['USER_NAME' => 'John', 'SITE_NAME' => 'Acme'],
    'john@doe.com',
    'John Doe',
    $langId
);

// Check a right before acting (B0f)
$rights = $sm->get('MelisCoreRights');
if (! $rights->canAccess('melismymodule_tool')) {
    // not allowed
}

// Read a per-platform config value (B0i)
$config  = $sm->get('MelisCoreConfig');
$merged  = $config->getItemPerPlatform('/meliscore/datas/');

Key files

ConcernPath
Module bootstrapvendor/melisplatform/melis-core/src/Module.php
Routes, services, controllers, view helpersvendor/melisplatform/melis-core/config/module.config.php
Backoffice shell & tools tree (interface)vendor/melisplatform/melis-core/config/app.interface.php
DataTable tool declarationsvendor/melisplatform/melis-core/config/app.tools.php
Micro-service endpointsvendor/melisplatform/melis-core/config/app.microservice.php
Servicesvendor/melisplatform/melis-core/src/Service/
Controllersvendor/melisplatform/melis-core/src/Controller/
Table gatewaysvendor/melisplatform/melis-core/src/Model/Tables/
Listenersvendor/melisplatform/melis-core/src/Listener/
Install SQL & migrationsvendor/melisplatform/melis-core/install/
Translationsvendor/melisplatform/melis-core/language/

See also: Module reference, Create a tool, Plugins