Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jan 31, 2025. It is now read-only.

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

License

NotificationsYou must be signed in to change notification settings

technically-php/rack-utils-http-query

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tiny package to build HTTP URL query string compatible with Rails app.

Usage

This library produces output without explicit indices. As simple as that.

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

Motivation

PHP stockhttp_build_query()converts array into items with indices explicitly defined.This is not compatible with the way Rails applications parse requests.

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

  1. php url query nested array with no index

Details

This package followsRack::Utils.parse_nested_queryspecification.Please checkRackUtilsHttpQueryTest.php.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp