PHPackages                             jameswmcnab/config-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jameswmcnab/config-yaml

Abandoned → [pragmarx/yaml](/?search=pragmarx%2Fyaml)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

jameswmcnab/config-yaml
=======================

A simple YAML config file loader for Laravel, taking inspiration from illuminate/config.

v3.0.0(7y ago)24.3k3[1 issues](https://github.com/jameswmcnab/config-yaml/issues)MITPHPPHP &gt;=7.0

Since Feb 16Pushed 6y ago2 watchersCompare

[ Source](https://github.com/jameswmcnab/config-yaml)[ Packagist](https://packagist.org/packages/jameswmcnab/config-yaml)[ RSS](/packages/jameswmcnab-config-yaml/feed)WikiDiscussions master Synced 1mo ago

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

Abandoned
=========

[](#abandoned)

This package is abandoned and no longer maintained. The author suggests using the pragmarx/yaml package instead.

YAML Config Loader for Laravel
==============================

[](#yaml-config-loader-for-laravel)

[![Build Status](https://camo.githubusercontent.com/96a19e5e7f39489ecd5f45ed7c98759a82dcceb12749840ab1b266df897e98e3/68747470733a2f2f7472617669732d63692e6f72672f6a616d6573776d636e61622f636f6e6669672d79616d6c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jameswmcnab/config-yaml)

This provides simple YAML config loading to Laravel. It takes a lot of inspiration from the `illuminate/config` package and uses the Symfony YAML parser.

This is not a replacement for the built-in PHP config file system in Laravel but is intended as an extra 'layer' of configuration. This allows you to have one or more Ruby-like `config.yaml` files containing user-configurable config for your application.

By default the package assumes your YAML files are in the `base_path()` directory, but you can customise this by publishing the package config file (`config-yaml.php`) to your application and changing the `yaml_path` key.

Installation
------------

[](#installation)

Installation is via Composer:

```
$ composer require jameswmcnab/config-yaml
```

#### Publish package config (optional)

[](#publish-package-config-optional)

If you want to customise the package config, publish the package config then edit the newly created `config/config-yaml.php` file:

```
$ php artisan vendor:publish --provider=ConfigYamlServiceProvider
```

Usage
-----

[](#usage)

Example YAML file:

```
# Example YAML config.yaml file
app:
  name: "Great App"
  version: 1.0.2

log:
  dir: /var/log/vendor/app
  level: debug

database:
  adapter: mysql
  database: app_live
  username: user
  password: password
```

#### Using the facade

[](#using-the-facade)

**Note: Remember to register the facade in your `app.php` config.**

```
ConfigYaml::get('config.database.adapter'); // mysql
```

#### Using dependency injection

[](#using-dependency-injection)

If you don't want to use the facade just directly inject `Jameswmcnab\ConfigYaml\RepositoryInterface` wherever dependency injection is supported and use it directly:

```
