Skip to content

marc-schumann/yamlpathloader

Repository files navigation

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;
	}));

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages