New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

pragmarx/yaml

Load your Laravel config files using yaml
2,965,968 114

Larablocks Analysis

Compatibility

Trusted maintainer

pragmarx/yaml works with Laravel 5 to 11 (latest release v1.3.1, Sep 27, 2024), all past end of life (the last on Mar 12, 2026): no more fixes, even for security.

  • Trusted maintainer: pragmarx publishes 23 packages on Larablocks, with 17,272,329 downloads a month between them.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 5 to 11, past end of life since Mar 12, 2026
  • No release in the last 12 months (last: Sep 27, 2024)
  • 30,840 downloads a month (at least 10,000)
  • 114 GitHub stars (at least 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Sep 27, 2024.
  • No releases in the last 12 months.
  • First released: Nov 30, 2017.
  • Monthly downloads: 30,840, up 42% from six months ago.
  • 3 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 25, 2026.

Install
composer require pragmarx/yaml
Latest Version:v1.3.1
PHP:>=7.0
Laravel:5 – 11
License:MIT
Last Updated:Sep 27, 2024
Links: GitHub  ·  Packagist
Maintainer: AntonioCarlosRibeiro

YAML

A Laravel YAML parser and config loader

Latest Stable Version License Code Quality Build

Coverage StyleCI SensioLabsInsight

Rationale

Config files getting bigger, harder to maintain and look at, every day. Why not just use YAML to load them?

Which one is cleaner?

Key features

Load one file to Laravel config

Yaml::loadToConfig(config_path('myapp.yml'), 'my-app-conf');

Or a whole directory, recursively, so all those files would be loaded with a single command

Yaml::loadToConfig(config_path('myapp'), 'my-app-conf');

To load a directory with all your config files:

.
└── myapp
    ├── multiple
    │   ├── alter.yml
    │   ├── app.yml
    │   └── second-level
    │       └── third-level
    │           ├── alter.yml
    │           └── app.yml
    ├── single
        └── single-app.yml

Then you would just have to use it like you usually do in Laravel

config('my-app-conf.multiple.second-level.third-level.alter.person.name')

Execute functions, like in the usual Laravel PHP array config.

repository: "{{ env('APP_NAME') }}"
path: "{{ storage_path('app') }}"

Config values can reference config keys, you just have to quote it this way:

{{'format.version'}}

You can add comments to your YAML files, something JSON wouldn't let you do

build:
  mode: git-local  #### other modes: git-remote or number

Parser and dumper methods

In case you need to deal with YAML directly, you can use these public methods:

Yaml::parse($input, $flags) // Parses YAML into a PHP value.

Yaml::parseFile($filename, $flags) // Parses a YAML file into a PHP value.

Yaml::dump($input, $inline, $indent, $flags) // Dumps a PHP value to a YAML string.

Which are simple bridges to Symfony's YAML.

Install

Via Composer

$ composer require pragmarx/yaml

Using

Publish your package as you would usually do:

$this->publishes([
    __DIR__.'/../config/version.yml' => $this->getConfigFile(),
]);

Load the configuration in your boot() method:

$this->app
     ->make('pragmarx.yaml')
     ->loadToConfig($this->getConfigFile(), 'my-package');

Or use the Facade:

Yaml::loadToConfig(config_path('myapp.yml'), 'my-package');

And it's merged to your Laravel config:

config('my-package.name');

Utilize PECL YAML

To utilize the PECL YAML, you should install the PECL YAML extension and register the binding in the register() method of your service provider:

$this->app->bind(\PragmaRX\Yaml\Package\Support\Parser::class, \PragmaRX\Yaml\Package\Support\PeclParser::class);

Example

This is a YAML file from another package using this package:

current:
  major: 1
  minor: 0
  patch: 0
  format: "{$major}.{$minor}.{$patch}"
cache:
  enabled: true
  key: pragmarx-version
build:
  mode: git-local # git-remote or number
  number: 701031
  git-local: "git rev-parse --verify HEAD"
  git-remote: "git ls-remote {$repository} refs/heads/master"
  repository: "{{ env('APP_GIT_REPOSITORY') }}"
  length: 6
format:
  version: "{$major}.{$minor}.{$patch} (build {$build})"
  full: "version {{'format.version'}}"
  compact: "v{$major}.{$minor}.{$patch}-{$build}"
  ## add as many formats as you need

Minimum requirements

  • Laravel 5.5
  • PHP 7.0

Author

Antonio Carlos Ribeiro

License

This package is licensed under the MIT License - see the LICENSE file for details

Contributing

Pull requests and issues are welcome.

Related Packages

laravel-dev-common/union-config

Laravel dev config util

209 0
jani/laravel-db-config

laravel 读写数据库Config,基于Laravel5.1插件。

42 0
anourvalar/config-helper

Helper functions over Laravel config

12,031 0
thetispro/laravel5-setting

Persistent configuration settings for Laravel 5 - Create, Read, Update and Delet...

9,682 24
kkszymanowski/laravel-js-config

Publish Laravel configuration to JS

9,351 0

Version History

Version Released PHP Laravel License
v1.3.1 >=7.0 >=5.5.33 MIT
v1.3.0 >=7.0 >=5.5.33 MIT
v1.2.1 >=7.0 >=5.5.33 MIT
v1.2.0 >=7.0 >=5.5.33 MIT
v1.1.0 >=7.0 >=5.5.33 MIT