2017 © Pedro Peláez
 

library rack-utils-http-query

Tiny package to build HTTP URL query string compatible with Rails apps

image

technically-php/rack-utils-http-query

Tiny package to build HTTP URL query string compatible with Rails apps

  • Tuesday, November 1, 2016
  • by e1himself
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

RackUtils HTTP query

Tiny package to build HTTP URL query string compatible with Rails app., (*1)

Usage

This library produces output without explicit indices. As simple as that., (*2)

``` php $vars = ['fruits' => ['apple', 'banana', 'orange']]; $query_string = \TechnicallyPhp\RackUtilsHttpQuery::build($vars); var_dump($query_string); // will output: "fruits[]=apple&fruits[]=banana&fruits[]=orange", (*3)


# Motivation PHP stock [`http_build_query()`](http://php.net/manual/en/function.http-build-query.php) converts array into items with indices explicitly defined. This is not compatible with the way Rails applications parse requests. ``` php $vars = ['fruits' => ['apple', 'banana', 'orange']]; $query_string = http_build_query($vars); var_dump($query_string); // will output: "fruits[0]=apple&fruits[1]=banana&fruits[2]=orange"

Relevant StackOverflow discussions:, (*4)

  1. php url query nested array with no index

Details

This package follows Rack::Utils.parse_nested_query specification. Please check RackUtilsHttpQueryTest.php., (*5)

The Versions

01/11 2016

dev-master

9999999-dev

Tiny package to build HTTP URL query string compatible with Rails apps

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Avatar e1himself

01/11 2016

1.0

1.0.0.0

Tiny package to build HTTP URL query string compatible with Rails apps

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Avatar e1himself