mascherucci / pimpyaml-container
A simple Pimple container configurable from yaml file, symfony's style syntax
Installs: 36
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
pkg:composer/mascherucci/pimpyaml-container
Requires
- php: >=5.5.0
- container-interop/container-interop: 1.1
- pimple/pimple: 3.0
- symfony/yaml: 3.1
Requires (Dev)
- codeception/aspect-mock: ~1.0.0
- codeception/codeception: ~2.1.7
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%