PHPackages                             sigep/request - 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. sigep/request

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

sigep/request
=============

Utility for parse querystring

0.2.10(10y ago)41.4k↓50%2[1 issues](https://github.com/Cohros/Request/issues)MITPHPPHP &gt;=5.4.0

Since Mar 31Pushed 2y ago2 watchersCompare

[ Source](https://github.com/Cohros/Request)[ Packagist](https://packagist.org/packages/sigep/request)[ RSS](/packages/sigep-request/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (16)Used By (0)

Request
=======

[](#request)

This package aims to facilitate the parse of the querystring and get some information about what data the user want to obtain.

> (!) This package just parses the querystring and returns a formatted array. It doesn't interact with the database or anything like it. The data that will be returned and the application of the filters, orderings, etc, depends of the implementation of the application.

Installation:
-------------

[](#installation)

Add the repository and declare the dependency in your `composer.json`.

```
{
    [...]
    "repositories": [
        [...]
        {
            "type": "git",
            "url": "git@github.com:Cohros/Request.git"
        }
    ],
    "require": {
        [...]
        "sigep/request": "*"
    },
}
```

Run the following command:

```
composer update

```

Usage
-----

[](#usage)

The Request supports pagination, ordinations, filters and searches.

### Pagination

[](#pagination)

To pagination, Request uses the `page` and `offset` parameters.

Examples:

```
GET /cities
GET /cities?page=2
GET /cities?offset=100
GET /cities?offset=100&page=2

```

- The first request will obtain all cities;
- The second will return the second page of the list. By default, the offset is set to 15, so only 15 cities will be returned;
- The third will return the first 100 cities. The request doesn't specify the page, but defines a offset, so Request assumes that is the first page;
- The fourth request will return the second page of the list, with offset of 100.

To determine if the request wants pagination or not, you use:

```
$Request = new \Sigep\Request\Request;
$Request->paginate(); // returns a boolean
```

To get the page requested, use:

```
$Request->page(); // returns a integer
```

To get the offset, use:

```
$Request->offset(); // returns a integer
```

To set a default offset (the package default is 15), use:

```
$Request->setDefaultOffset(100); // set the default to 100
```

### Embed

[](#embed)

Sometimes the resources have relationships with other resources and you want to be able to provide those relationships if the user want them. The `embed` parameter is used in those situations.

Examples:

```
GET /cities?embed=country
GET /cities?embed=country,state

```

- The first request will return all cities and each one will have it's country;
- The second will return all cities with country and state.

To get the the list of embedded relationships, use:

```
$Request->embed(); // return a array
```

### Ordination

[](#ordination)

You can sort the list of objects by any of its properties.

Examples:

```
GET /cities?sort=name
GET /cities?sort=-name
GET /cities?sort=state,name

```

- The first request will return the list of cities ordered by name A-Z;
- The second will return the list of cities ordered by name Z-A;
- The third will return the list of cities ordered by state A-Z and name A-Z;

To get the parameters to ordination, use:

```
// GET /cities?sort=state,name
$sort = $Request->sort();

/**
$sort will be similar to:
array (
    'state' => 'ASC',
    'name' => 'ASC',
)
**/
```

### Search

[](#search)

Examples:

```
GET /cars?q=peugeot

```

- The above request will search for cars with `peugeot`. The query can be performed checking the name, description, brand or anything that the resource has.

To get the parameter, use:

```
$Request->search(); // return a string
```

> It's up to the application define how the search will be performed and the operators that will be used (equals, like etc).

### Filters

[](#filters)

Filters allow you to filter the results based on its properties.

Examples:

```
GET /user?gender=female
GET /user?age=>20&gender=female
GET /user?age=>20,,30<
GET /users?age=20;30

```

- The first request will return a list of all female users;
- The second will return a list of female users that are older then 20 years;
- The third will return a list of users that are older then 20 and younger then 30 years (between 20 and 30 exclusive);
- The third will return a list of users that have 20 years or more and 30 years or less (between 20 an 30 inclusive);
- The fourth will return a list of users that have 20 or 30 years;

To get the filters parameters, use:

```
$filters = $Request->filter();
/**
GET /user?gender=female
$filters = array (
    'gender' => array (
        '=' => 'female',
    )
);

GET /user?age=+20&gender=female
$filters = array (
    'age' => array ('>' => array ('20')),
    'female' => array ('=' => array (0 => 'female')),
);

GET /users?age=20;30
$filters = array (
    'age' => array (
        '=' => array('20', '30'),
    )
);
```

> Note that the filters are parameters on the querystring. Some words are reserved by other methods, like *page*, *offset* and *sort*.

For more information, explore the source :)

> Written with [StackEdit](https://stackedit.io/).

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.1% 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 ~47 days

Recently: every ~132 days

Total

14

Last Release

3823d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/447facbc5e980eabe3a34ff1bcf74d5aa742e122e54d8e22168c9264f7f171e3?d=identicon)[beeblebrox3](/maintainers/beeblebrox3)

---

Top Contributors

[![beeblebrox3](https://avatars.githubusercontent.com/u/767624?v=4)](https://github.com/beeblebrox3 "beeblebrox3 (48 commits)")[![JzTurrini](https://avatars.githubusercontent.com/u/5420317?v=4)](https://github.com/JzTurrini "JzTurrini (2 commits)")[![f4usto](https://avatars.githubusercontent.com/u/1486888?v=4)](https://github.com/f4usto "f4usto (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sigep-request/health.svg)

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

###  Alternatives

[laracasts/utilities

Transform your PHP to JavaScript

2.2k10.0M39](/packages/laracasts-utilities)[lord/laroute

Access Laravels URL/Route helper functions, from JavaScript.

8022.0M8](/packages/lord-laroute)[spatie/server-side-rendering

Server side rendering JavaScript in your PHP application

631780.3k3](/packages/spatie-server-side-rendering)[fluidtypo3/flux

The flux package from FluidTYPO3

152982.2k20](/packages/fluidtypo3-flux)[dusterio/link-preview

Link preview generation for PHP with Laravel support

126326.6k3](/packages/dusterio-link-preview)[iamcal/lib_autolink

Adds anchors to urls in a text

631.3M3](/packages/iamcal-lib-autolink)

PHPackages © 2026

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