rev/sway-framework-distribution

SwayFramework Distribution Component

dev-master 2017-06-01 16:48 UTC

This package is not auto-updated.

Last update: 2024-05-21 22:01:01 UTC


README

This component helps to manage swayframework and vendor packages. It also provides a feature to manage configuration around packages and app.

Installation

This package is bundled with swayframework.

composer require rev/sway-framework-distribution

This will install package at latest version.

Usage

<?php

use Sway\Distribution\FrameworkDistribution;

/**
* Points to application root directory.
 */
$applicationDirectoryRootPath = dirname(__DIR__);

/**
* Inits framework distribution.
 */
$frameworkDistribution = new FrameworkDistribution($applicationDirectoryRootPath);


?>

Please remember that subdirectory tmp must exists in your app directory. It will not be created if not exists.

Built-in services

Distribution component comes with built-in services (of course if service component is available).

List of all built-in services:

  • Service: 'distribution_storage'
    Class: Sway\Distribution\Storage\StorageDriver
    Description: Storage driver - vendor's packages and application cache

  • Service: 'distribution_class_founder'
    Class: Sway\Distribution\Mapping\ClassFounder
    Description: Application class map

  • Service: 'distribution_extension_manager'
    Class: Sway\Distribution\Extension\ExtensionManager
    Description: 'sf-package' libraries manager

For defaults, built-in services are not registered. If framework kernel is initialized and service and parameter component are available, you can call method initDistribution to register built-in services.

$frameworkDistribution->initDistribution();

You can also initialize a interface to framework as service (service: framework):

$frameworkDistribution->initializeFrameworkService($array_with_parameters);