mascherucci/pimpyaml-container

This package is abandoned and no longer maintained. No replacement package was suggested.

A simple Pimple container configurable from yaml file, symfony's style syntax

1.1.3 2016-10-03 16:21 UTC

This package is not auto-updated.

Last update: 2022-05-14 06:26:57 UTC


README

Pimpyaml is a simple configuration package for Pimple container. It implements ContainerInterface, so you can switch easly with another container

#Install composer require mascherucci/pimpyaml-container

Usage

You can obviously define the service in normal way or you can define with yaml config.yml file with symfony like syntax

Defining Services

Loading config file

  $conf_file = __DIR__.'/config.yml';
  $config = \SwissArmy\ConfigHandler::loadConf($conf_file);
  $container = new \SwissArmy\SimpleContainer($config);

ConfigHandler support several imports -> resource if you want to separate domain of configuration as you can see below

imports:
    - resource: dependency.yml
    - resource: routes.yml
customvalues:
    custom1: 1    

The Services

services:
    zone:
        class: \DateTimeZone
        arguments: ['America/Adak']
    time:
        class: \DateTime
        arguments: ['2016-01-01','@zone']
    time2
        class: \DateTime
        calls:
            - [setTimezone , ['@zone']]
    dummy
        class: \yourclass
        arguments: ['@container']
    dummy2
        class: \yourclass
        arguments: ['%custom1%']        

At moment the only markdown support, as you can see, is @object,@container(is a special word to pass the container),%yourvariable%