melisplatform/melis-platform-framework-silex

A Silex framework dependecy to for running silex inside Melis Platform

v4.1.0 2020-02-07 05:01 UTC

README

This module runs the Silex micro-framework inside Melis Platform.
The melis-platform-framework silex contains a Silex Service Provider to let Silex use Melis services available.

Getting Started

These instructions will guide you to run the Silex micro-framework inside Melis Platform.

Prerequisites

This module requires melisplatform/melis-core and silex/silex in order to have this module running. This will automatically be done when using composer.

Installing

composer require melisplatform/melis-platform-framework-silex

Service Providers

In order to load and use a service provider, you must register the service provider in the Silex application which is commonly located in /Silex/src/app.php

use MelisPlatformFrameworkSilex\Provider\MelisServiceProvider;

$app = new Silex\Application();

$app->register(new MelisServiceProvider());

Usage

Example of using the MelisServiceProvider in Silex framework.

$melisNewsService = $app['melis.services']->getService("MelisCmsNewsService");
$news = $melisNewsService->getNewsList();

Where to find Melis Services

  • Melis Services are found inside each Melis Modules and these melis modules can be found by following the path below.
/_docroot_/vendor/melisplatform/
  • Inside each Melis Module you can find module.config.php in the config folder.
    The module.config.php contains an array keys called aliases and factories under service_manager.
'service_manager' => array(
    'invokables' => array(
        
    ),
    'aliases' => array(
        'translator' => 'MvcTranslator',
        'MelisCmsNewsTable' => 'MelisCmsNews\Model\Tables\MelisCmsNewsTable',
        'MelisCmsNewsTextsTable' => 'MelisCmsNews\Model\Tables\MelisCmsNewsTextsTable',
    ),
    'factories' => array(
        //services
        'MelisCmsNewsService' => 'MelisCmsNews\Service\Factory\MelisCmsNewsServiceFactory',
        
        //tables
        'MelisCmsNews\Model\Tables\MelisCmsNewsTable' => 'MelisCmsNews\Model\Tables\Factory\MelisCmsNewsTableFactory',
        'MelisCmsNews\Model\Tables\MelisCmsNewsTextsTable' => 'MelisCmsNews\Model\Tables\Factory\MelisCmsNewsTextsTableFactory',
    ),
),
  • The array keys inside aliases or factories can be called in Selix using the MelisServiceProvider.
$melisNewsSvc = $app['melis.services']->getService("MelisCmsNewsService");