Skip to content
Extends the YamlFileLoader from Symfony in order to load whole paths with yaml files in it. E.g. translation files.
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/MarcSchumann/YamlPathLoader
.coveralls.yml
.gitignore
.travis.yml
LICENSE
README.md
composer.json
phpunit.xml

README.md

Build Status

YamlPathLoader

Extends the YamlFileLoader from Symfony in order to load whole paths with yaml files in it. E.g. translation files.

Installation

Install YamlPathLoader via your composer as follows:

	php composer.phar require marcschumann/yamlpathloader:dev-master
	

Usage


	// Loading translations in silex microframework
	
	$app->register(new Silex\Provider\TranslationServiceProvider());
	$app['translator'] = $app->share($app->extend('translator', function($translator, $app) {
   		$translator->setLocale($app['locale']);

    	// Using YamlPathLoader - Extension for loading translation files from a directory
    	$translator->addLoader('yaml', new \MarcSchumann\YamlPathLoader\YamlPathLoader);
    	$translator->addResource('yaml', __DIR__.'/locales/en/', 'en');
    	$translator->addResource('yaml', __DIR__.'/locales/de/', 'de');

    	return $translator;
	}));
You can’t perform that action at this time.