PHPackages                             owowagency/applies-http-query - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. owowagency/applies-http-query

ActiveLibrary[HTTP &amp; Networking](/categories/http)

owowagency/applies-http-query
=============================

v3.0.0(2y ago)07.7k1[1 issues](https://github.com/owowagency/applies-http-query/issues)[1 PRs](https://github.com/owowagency/applies-http-query/pulls)PHPPHP ^8.1

Since Jul 11Pushed 2y agoCompare

[ Source](https://github.com/owowagency/applies-http-query)[ Packagist](https://packagist.org/packages/owowagency/applies-http-query)[ RSS](/packages/owowagency-applies-http-query/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (3)Versions (12)Used By (0)

owowagency/applies-http-query
=============================

[](#owowagencyapplies-http-query)

This package contains a trait that can be used on Eloquent models. The trait adds a `httpQuery` scope that can apply a "search" and "order by". It will only apply these two when certain url query parameters are present.

Install
-------

[](#install)

```
composer require owowagency/applies-http-query

```

This package supports Laravel version 5 to 7. Check the [1.x branch](https://github.com/owowagency/applies-http-query/tree/1.x).

Usage
-----

[](#usage)

Add the trait to the model:

```
use OwowAgency\AppliesHttpQuery\AppliesHttpQuery;

class Post extends Model
{
    use AppliesHttpQuery
}

```

Specify the columns on which it can search:

```
/**
 * Http queryable rules.
 *
 * @var array
 */
protected $httpQueryable = [
    'columns' => [
        'posts.title'
        'users.name',
    ],
    'joins' => [
        'users' => ['posts.user_id','users.id'],
        'countries' => ['users.country_id', 'countries.id']
    ],
];

```

Call the scope:

```
Post::httpQuery()->paginate();

// Like all other scopes it can be combined with other clauses.
Post::whereNull('deleted_at')->httpQuery()->get();

```

In order for the scope to work, certain query parameters should be present in the url:

- `search`, the value that will be searched for.
- `order_by`, the column that will be ordered on.
- `sort_by`, the direction of the ordering. By default this is `asc`.

### Search

[](#search)

```
https://mysite.com/posts?search=test

```

Will result in the following query:

```
SELECT * FROM posts INNER JOIN users ON posts.user_id = users.id WHERE (posts.title LIKE "%test%" OR users.name LIKE "%test%")

```

### Order by

[](#order-by)

```
https://mysite.com/posts?order_by=user.name

```

Will result in the following query:

```
SELECT * FROM posts INNER JOIN users ON posts.user_id = users.id ORDER BY users.name ASC

```

```
https://mysite.com/posts?order_by=user.country.name&sort_by=desc

```

Will result in the following query:

```
SELECT * FROM posts INNER JOIN users ON posts.user_id = users.id INNER JOIN countries ON users.country_id = country.id ORDER BY countries.name desc

```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~166 days

Recently: every ~264 days

Total

10

Last Release

996d ago

Major Versions

1.2.1 → 2.0.02020-09-25

v1.1.2 → v2.0.12021-01-27

v2.0.1 → v3.0.02023-08-18

PHP version history (4 changes)v1.0.0PHP ^7

2.0.0PHP ^7.3

v1.1.2PHP ^7.3|^8.0

v3.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b0064d818f9593dfb4f9d86217bbf5f14961ad6779b84fd5546dd91f296d898?d=identicon)[dees040](/maintainers/dees040)

---

Top Contributors

[![thomasowow](https://avatars.githubusercontent.com/u/45201651?v=4)](https://github.com/thomasowow "thomasowow (10 commits)")[![dees040](https://avatars.githubusercontent.com/u/5390555?v=4)](https://github.com/dees040 "dees040 (8 commits)")[![YouneselBarnoussi](https://avatars.githubusercontent.com/u/16510310?v=4)](https://github.com/YouneselBarnoussi "YouneselBarnoussi (4 commits)")[![albertpratomo](https://avatars.githubusercontent.com/u/25815584?v=4)](https://github.com/albertpratomo "albertpratomo (1 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/owowagency-applies-http-query/health.svg)

```
[![Health](https://phpackages.com/badges/owowagency-applies-http-query/health.svg)](https://phpackages.com/packages/owowagency-applies-http-query)
```

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[dragon-code/laravel-http-logger

Logging incoming HTTP requests

319.8k3](/packages/dragon-code-laravel-http-logger)[laravel-shift/curl-converter

A command line tool to convert curl requests to Laravel HTTP requests.

935.3k](/packages/laravel-shift-curl-converter)[onlime/laravel-http-client-global-logger

A global logger for the Laravel HTTP Client

1935.1k](/packages/onlime-laravel-http-client-global-logger)

PHPackages © 2026

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