PHPackages                             theofidry/laravel-yaml - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. theofidry/laravel-yaml

AbandonedArchivedLibrary[Parsing &amp; Serialization](/categories/parsing)

theofidry/laravel-yaml
======================

Laravel ServiceProvider for using YAML configuration files

v1.0.0-beta.2(10y ago)105.6k2[1 issues](https://github.com/theofidry/LaravelYaml/issues)MITPHPPHP &gt;=5.5.9

Since Mar 7Pushed 9y ago1 watchersCompare

[ Source](https://github.com/theofidry/LaravelYaml)[ Packagist](https://packagist.org/packages/theofidry/laravel-yaml)[ RSS](/packages/theofidry-laravel-yaml/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (3)Dependencies (6)Versions (3)Used By (0)

Laravel Yaml ServiceProvider
============================

[](#laravel-yaml-serviceprovider)

[![Package version](https://camo.githubusercontent.com/0bb01fab64ce823fb36b056a49cfa47b314113a47b3a9445a78dcf0051507102/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7468656f66696472792f6c61726176656c2d79616d6c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/theofidry/laravel-yaml)[![Build Status](https://camo.githubusercontent.com/7ebcef031177e523b07e88fd52369669526f917b2edf7cf7d21dd44aa164248d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7468656f66696472792f4c61726176656c59616d6c2e7376673f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://travis-ci.org/theofidry/LaravelYaml?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/4145aeb32948037226eec6b0ab277660a1ba5cd2cfe1a1a9da44340929647f82/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f37316461626133642d323730362d343338372d396434372d3433346462343433643331302e7376673f7374796c653d666c61742d737175617265)](https://insight.sensiolabs.com/projects/71daba3d-2706-4387-9d47-434db443d310)[![Dependency Status](https://camo.githubusercontent.com/644e480e4faee46fdf12dc48ddeebad4623818982d25fc68664420e40e59f477/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3536646461623964343833396637303033353230376330312f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/user/projects/56ddab9d4839f70035207c01)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/0f24b6e71460f3e2a57631e25d0ab4374740bdd086768a6447710ffc16f01f76/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7468656f66696472792f4c61726176656c59616d6c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/theofidry/LaravelYaml/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/035476d034ca1d03ea78a6c5cd98a37d516a261f924c03b5a0d96ee2fc66c48c/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f7468656f66696472792f4c61726176656c59616d6c2e7376673f623d6d6173746572267374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/theofidry/LaravelYaml/?branch=master)[![License](https://camo.githubusercontent.com/10e85a5778fe7601504a17ecd18dfa7097f473186b0f947bc10db2d3e4f530e4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d7265642e7376673f7374796c653d666c61742d737175617265)](LICENSE)

A simple Laravel library to declare your parmeters and services in [Yaml](http://symfony.com/doc/current/components/yaml/yaml_format.html)like in [Symfony](http://symfony.com/doc/current/components/dependency_injection/advanced.html):

```
# resources/providers/services.yml

services:
    dummy_service:
        class: App\Services\DummyService
        alias: dummy
        arguments:
            - %app.url%
            - %app.env%
```

instead of:

```
# app/Providers/AppServiceProvider.php

//...
public function register()
{
    $this->app->singleton(
        'dummy_service',
        function ($app) {
            $url = env('APP_URL');
            $env = env('APP_ENV');

            return new \App\Services\DummyService($url, $env);
        }
    );
}
```

Documentation
-------------

[](#documentation)

1. [Disclaimer: why using this library?](doc/disclaimer.md)
2. [Install](#install)
3. [Everything about parameters](doc/parameters.md)
4. [YAML vs PHP](doc/parameters.md#yaml-vs-php)
5. [Refering to another value](doc/parameters.md#refering-to-another-value)
6. [Refering to an environment value](doc/parameters.md#refering-to-an-environment-value)
7. [Refering to constants](doc/parameters.md#refering-to-constants)
8. [Overriding values](doc/parameters.md#overriding-values)
9. [Environment dependent parameters](doc/parameters.md#environment-dependent-parameters)
10. [Service declaration](doc/services.md)
11. [Simple services](doc/services.md#simple-services)
12. [Factories](doc/services.md#factories)
13. [Decorating services](doc/services.md#decorating-services)
14. [Custom file organisation](doc/customize.md)
15. [Import other files](doc/customize.md#import-other-files)
16. [Use your own provider](doc/customize.md#use-your-own-provider)

Install
-------

[](#install)

You can use [Composer](https://getcomposer.org/) to install the bundle to your project:

```
composer require theofidry/laravel-yaml
```

Then, add the provider [`Fidry\LaravelYaml\Provider\DefaultExtensionProvider`](src/Provider/DefaultExtensionProvider.php) to your application providers:

```
