PHPackages                             nnssn/straw - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. nnssn/straw

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nnssn/straw
===========

Bridge of query string and output.

0.9.7(10y ago)021MITPHPPHP &gt;=5.3.2

Since Jan 16Pushed 10y ago1 watchersCompare

[ Source](https://github.com/nnssn/straw)[ Packagist](https://packagist.org/packages/nnssn/straw)[ Docs](https://github.com/nnssn/straw)[ RSS](/packages/nnssn-straw/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

Straw
=====

[](#straw)

Straw will make a bridge of query string(URL parameter) and output.

Requirement
-----------

[](#requirement)

PHP 5.3.\*

Install
-------

[](#install)

```
composer require nnssn/straw:@0.9.*

```

Usage
-----

[](#usage)

### Basic

[](#basic)

```
require 'vendor/autoload.php';

use Straw\Straw;

$s = Straw::open();
$s->alpha('type');
$s->num('page', 1);      //Second parameter is default value.
$s->alphanum('missing');
$s->numList('point');
$result = $s->make();

access http://example.com/?type=all&point=10,20

//result
array
  'type'  => 'all'
  'page'  => 1
  'point' => array
    0 => 10
    1 => 20

```

### Change the output key.

[](#change-the-output-key)

```
$s->alphanum('s')->to('search');
$s->num('page')->to('condtions.limit');
$s->num('min')->to('price.');
$s->num('max')->to('price.');

//result
array
  'search' => 's_value'
  'conditions' =>
    'limit' => page_value
  'price' =>
    0 => min_value
    1 => max_value

```

### Basic rule

[](#basic-rule)

```
$s->alpha    //a-zA-z_
$s->num      //0-9
$s->alphanum //0-9a-zA-z_

```

### List rule

[](#list-rule)

```
$s->alphaList    //alpha or alpha,alpha...
$s->numList      //num or num,num...
$s->alphanumList //alphanum or alphanum,alphanum...

$s->numList('values');
access http://example.com/?values=1,2,2
//result
array
  'values' =>
    0 => 1
    1 => 2
    2 => 2

```

### Set rule

[](#set-rule)

```
$s->alphaSet    //alpha or alpha;alpha...
$s->numSet      //num or num;num...
$s->alphanumSet //alphanum or alphanum;alphanum...

$s->numSet('values');
access http://example.com/?values=1;2;3
//result
array
  'values' =>
    0 => 1
    1 => 2
    2 => 3

//Set rule is not allow duplicate values.
access http://example.com/?values=1;2;2
//result
null

```

### Range rule

[](#range-rule)

```
$s->numRange      //1-10
$s->datetimeRange //20160101-20160116

$s->numRange('yes');
$s->numRange('no');
access http://example.com/?yes=1-10&no=10-1
//result
array
  'yes' =>
    0 => 1
    1 => 10

```

Licence
-------

[](#licence)

[MIT](http://opensource.org/licenses/mit-license.php)

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~38 days

Total

3

Last Release

3741d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9246606?v=4)[nnssn](/maintainers/nnssn)[@nnssn](https://github.com/nnssn)

---

Top Contributors

[![nnssn](https://avatars.githubusercontent.com/u/9246606?v=4)](https://github.com/nnssn "nnssn (14 commits)")

---

Tags

urlstringqueryparameter

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nnssn-straw/health.svg)

```
[![Health](https://phpackages.com/badges/nnssn-straw/health.svg)](https://phpackages.com/packages/nnssn-straw)
```

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k417.9M1.7k](/packages/nette-utils)[league/uri-components

URI components manipulation library

31937.4M89](/packages/league-uri-components)[spatie/url

Parse, build and manipulate URL's

74015.2M115](/packages/spatie-url)[sabre/uri

Functions for making sense out of URIs.

29436.8M44](/packages/sabre-uri)[spomky-labs/base64url

Base 64 URL Safe Encoding/Decoding PHP Library

15441.7M57](/packages/spomky-labs-base64url)[opis/string

Multibyte strings as objects

7424.5M8](/packages/opis-string)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
