Socket
Socket
Sign inDemoInstall

yaml2php

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    yaml2php

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


Version published
Weekly downloads
9
decreased by-10%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

yaml2php

Simple library to convert yaml configuration into PHP using yaml-ast-parser.

Installation

This is a Node.js module available through the npm registry. Installation is done using the npm install command:

$ 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;

Keywords

FAQs

Last updated on 20 Nov 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc