# yaml2php

> Simple library to convert yaml configuration into PHP using [yaml-ast-parser](https://github.com/mulesoft-labs/yaml-ast-parser).

Latest version **0.0.5** (published 2017-11-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install yaml2php
pnpm add yaml2php
yarn add yaml2php
bun add yaml2php
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2017-11-20 |
| First published | 2017-11-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Scott Smith |
| Maintainers | scomith |
| Keywords | yaml, php, config |

## Links

- npm: https://www.npmjs.com/package/yaml2php
- Repository: https://github.com/scottasmith/yaml2php
- Homepage: https://github.com/scottasmith/yaml2php#readme
- Issues: https://github.com/scottasmith/yaml2php/issues
- npm.io page: https://npm.io/package/yaml2php

## Dependencies (1)

- [yaml-ast-parser](https://npm.io/package/yaml-ast-parser.md) 0.0.39

## Alternatives

- [monaco-yaml](https://npm.io/package/monaco-yaml.md) — 420.1K weekly downloads
- [@crewx/workflow](https://npm.io/package/@crewx/workflow.md) — 3.1K weekly downloads
- [yaml-cat](https://npm.io/package/yaml-cat.md) — 38 weekly downloads
- [nunjucks-in-yaml](https://npm.io/package/nunjucks-in-yaml.md) — 9 weekly downloads
- [shopify-symlinks](https://npm.io/package/shopify-symlinks.md) — 3 weekly downloads

## Recent versions

- 0.0.5 (latest) — 2017-11-20
- 0.0.4 — 2017-11-20
- 0.0.3 — 2017-11-20
- 0.0.2 — 2017-11-19
- 0.0.1 — 2017-11-19

## README

# yaml2php

Simple library to convert yaml configuration into PHP using [yaml-ast-parser](https://github.com/mulesoft-labs/yaml-ast-parser).

## Installation

This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/). Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):


```
$ npm install yaml2php
```

## Usage

Read from file:
```
import { fromFile } from 'yaml2php';

try {
  var php = fromFile('example.yml');
  console.log(php);
} catch (e) {
  console.log(e);
}
```

Read from string:
```
import { fromString } from 'yaml2php';

try {
  var php = fromString(`---
key1:
    - 1
    - 'Two'
    - false
`);

  console.log(php);
} catch (e) {
  console.log(e);
}
```

For both functions, there are two options as second and third parameters.
These make the code more readable
```
function fromFile(filename: string, pretty?: boolean, indent?: number): string;
function fromString(value: string, pretty?: boolean, indent?: number): string;
```

---
_Source: https://npm.io/package/yaml2php · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
