JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 33751
  • Score
    100M100P100Q139601F
  • License MIT

laravel2js and js2laravel converter laravel php resource utils

Package Exports

  • laravelphp
  • laravelphp/cjs
  • laravelphp/cjs/js2laravel
  • laravelphp/cjs/laravel2js
  • laravelphp/esm
  • laravelphp/esm/js2laravel
  • laravelphp/esm/laravel2js
  • laravelphp/js2laravel
  • laravelphp/laravel2js
  • laravelphp/package.json

Readme

travis npm

Download

The source is available for download from GitHub. Alternatively, you can install using npm:

npm install --save laravelphp

You can then import or require() laravel as normal:

import laravelphp from 'laravelphp'
// or
const laravelphp = require('laravelphp')

laravelphp.laravel2js(php, (err, res) => {})

Or you can direclty import or require() its functions:

import resx2js from 'laravelphp/laravel2js'
// or
const resx2js = require('laravelphp/cjs/laravel2js')

Usage

const php = `<?php
  return [
    'key1' => 'Hello! Let\'s go!',
    'key2' => 'An application to manipulate and process laravel php language files',
    'key' => [
      'nested' => 'laravel Data Manager'
    ]
  ];`

const js = {
  "key1": "Hello! Let's go!",
  "key2": "An application to manipulate and process laravel php language files",
  "key": {
    "nested": "laravel Data Manager"
  }
}


import laravel2js from 'laravelphp/laravel2js'
laravel2js(php, (err, res) => {
  // res is like js
});

import js2laravel from 'laravelphp/js2laravel'
js2laravel(js, (err, res) => {
  // res is like php
});

Omitting the callback returns a promise

const resJs = await laravel2js(php)
const resPhp = await js2laravel(js)
// or
laravel2js(php).then((res) => {})
js2laravel(js).then((res) => {})