build-php-query
v1.0.1
Published
Generate PHP like URL-encoded query string
Downloads
2
Readme
buildPHPQuery
Generate PHP like URL-encoded query string
Install
npm install --save build-php-query
Usage
const buildPHPQuery = require('build-php-query')
buildPHPQuery({
page: 1,
user: {
username: 'user1',
name: 'User 1'
},
arrayOfRandomValues: [
12,
56,
78
]
})
gives:
'page=1&user[username]=user1&user[name]=User%201&arrayOfRandomValues[]=12&arrayOfRandomValues[]=56&arrayOfRandomValues[]=78'
This also supports nesting.
License
MIT © ArtemGolovko