PHPackages                             corbinjurgens/quaip - 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. [Database &amp; ORM](/categories/database)
4. /
5. corbinjurgens/quaip

ActiveLibrary[Database &amp; ORM](/categories/database)

corbinjurgens/quaip
===================

Database and Sessions for UA and IP

v1.0.0-rc1(4y ago)00MITPHP

Since Feb 23Pushed 4y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Introduction
------------

[](#introduction)

Load ip and user-agent models on each request for easy access. Keeps table key in session, and compares last value to see if needs to refresh. Models are lazy loaded, and you can get just the key without loading model. Also offers a simple framework to add custom models or customize the existing ones

Manual Installation
-------------------

[](#manual-installation)

Copy the following to main composer.(in the case that the package is added to packages/corbinjurgens/qform)

```
 "autoload": {
	"psr-4": {
		"Corbinjurgens\\Quaip\\": "packages/corbinjurgens/quaip/src"
	},
},

```

and run

```
composer dump-autoload

```

Add the following to config/app.php providers

```
Corbinjurgens\Quaip\ServiceProvider::class,

```

Add alias to config/app.php alias

```
"Quaip" => Corbinjurgens\Quaip\Facade::class,

```

Requires
--------

[](#requires)

If using the default Ip and User-Agent loaders, this package requires the following.

- Ip: stevebauman/location:&gt;=4.0.1 (requires configuration with geoip2/geoip2 or other) and grimzy/laravel-mysql-spatial ^4.0, ^3.0, ^2.0, or ^1.0 depending on your Laravel and Mysql version
- User-Agent: whichbrowser/parser:&gt;=2.0.18

They are configurable, and you may also add entirely different loaders that you create yourself.

Setup
-----

[](#setup)

If you wish to use the default Ip address (Ip) and User-Agent (Ua) loaders, be sure to install and configure the necessary packages above, and publish the database migration via `php artisan vendor:publish --tag="quaip-migrations"`, customize migrations if you want, and run the migrations

Change the config by publishing config file with `php artisan vendor:publish --tag="quaip-config`

Usage
-----

[](#usage)

Use the middleware "quaip" to load your configured loaders. Then your configured loaders can be accessed by Quaip::{loader name}() or Quaip::get({loader name}) such as Quaip::Ip();

By default all loaders in config quaip.loaders are loaded. To customize which loaders are used you can pass parameter to the middleware, eg: `->middleware('quaip:Ip,Info')` to load Ip and a custom loader called "Info"

To get just the key and avoid fetching the full model from the database, you can use Quaip::getKey({loader name}), which you can use for model relationships.

You can access Quaip::ip() or Quaip::ua() in any web controller to access a cached model

Use Corbinjurgens\\Quaip\\IpTrait and / or Corbinjurgens\\Quaip\\UaTrait trait to connect a table to ua() and ip() relationship

Custom loader
-------------

[](#custom-loader)

Add a custom loader by adding its name to config quaip.loaders, and adding each of the actions to config.actions (or if all actions are in one place, just the action name to namespace)

Actions should implement their respective interfaces at Corbinjurgens\\Quaip\\Actions\\Interfaces

Actions are:

- Fetch : get the target value, eg get the ip address
- Lookup : with the target value get info, eg get info about ip address such as coordinates
- Convert : with the data from lookup, format it in a way that can be easily added to database
- FindOrCreate : with the prepared data, search for a model, or create it
- Find : with the model id, find the model

For example if creating a loader called "Info" and all Actions share the same namespace and class names as above (eg Test\\Info\\Fetch), you can do the following inside the config quaip:

```
'loader' => [
	...
	'Info'
],
'actions' => [
	'Info' => "Test\\Info"
]

```

Modify existing loader
----------------------

[](#modify-existing-loader)

You can create your own class for one or more of the actions of Ip and Ua loaders, and overwrite the default by adding it to config quaip.actions. For example

```
namespace Test
class Fetch implements \Corbinjurgens\Quaip\Actions\Interfaces\Fetch{
	public static function action()
	{
		return $_SERVER['REMOTE_ADDR'];
	}
}

```

Then in config quaip

```
'actions' => [
	"Ip\\Fetch" => Test\Fetch::class
]

```

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

1536d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/171ca92c9485e447aa4e83d138a01ccd433e377faf2c005fc74fbf036499a2b8?d=identicon)[corbinjurgens](/maintainers/corbinjurgens)

---

Top Contributors

[![corbinjurgens](https://avatars.githubusercontent.com/u/64005306?v=4)](https://github.com/corbinjurgens "corbinjurgens (5 commits)")

### Embed Badge

![Health badge](/badges/corbinjurgens-quaip/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M543](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M209](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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