Download the PHP package diezz/yaml-to-object-mapper without Composer

On this page you can find all versions of the php package diezz/yaml-to-object-mapper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yaml-to-object-mapper

Scrutinizer Code Quality Build Status Code Coverage

Yaml to Object Mapper

Bridge the Gap Between YAML and PHP Objects

Effortlessly transform your YAML configurations into robust PHP objects with the Yaml to Object Mapper library. Embrace efficient mapping, powerful validation, and flexible variable processing, all while leveraging the convenience of PHP 8 attributes.

Key Features:

Installation

Basic usage

We have a simple config.yml file

which we want to be mapped to the object of class:

Setting Values in Target Class Properties

Setting Values in Target Class Properties The mapper automatically assigns mapped values to corresponding properties in the target class. Here's what to keep in mind:

Property Access:

Setter Naming:

Extended usage

Dynamic Field Mapping with Default Value Resolvers

Tired of writing redundant property names and nested lists in your YAML? Default value resolvers let you automatically infer field names and structure, streamlining your configuration.

Example:

Instead of this verbose YAML:

Imagine the conciseness of:

How it works:

Validation

By default, the mapper checks that required fields are present in yml file. There are multiple ways how the mapper defines which field is required:

  1. The most obvious way is mark required field with #[Required] attribute.
  2. If class field isn't marked with required attribute the mapper checks type hint of the field. It could be a php 7 type hint or phpdoc comment. Nullable properties or properties initiated with default value are treated as not required or vice verse.

Maintain the consistency and accuracy of your configurations with the library's integrated validation mechanisms. It offers a flexible approach to define required fields and enforce data types.

How It Works:

Dynamic Configuration with Variable Processing

Unleash the full potential of your YAML configurations with dynamic variable processing. The library supports various built-in variables and even allows you to create custom logic for advanced scenarios

Built-in variables:

Syntax:

${varName:firstArgument:secondArgument}

Another variable could be passed as an argument of another one, for example:

${varName1:${varName2:argument1}:argument2}

Custom Argument Resolvers

For even more flexibility, create custom argument resolvers to handle unique variable processing needs.

Steps:

In top of variable processing there is an ArgumentResolver. You can create your own ArgumentResolvers which gives an ability of processing custom variables in your yaml files. To do so create a class extending CustomArgumentResolver. Constructor of your CustomArgumentResolver implementation should accept ArgumentResolver which is resolver for argument of the variable. Count of params in the constuctor should be equals to count of argument supporting by the variable.

and now you can use inside yaml file, for example


All versions of yaml-to-object-mapper with dependencies

PHP Build Version
Package Version
Requires php Version >=8
symfony/yaml Version ^6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package diezz/yaml-to-object-mapper contains the following files

Loading the files please wait ....