PHPackages                             vormiaphp/vormiaqueryphp - 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. [API Development](/categories/api)
4. /
5. vormiaphp/vormiaqueryphp

ActiveLibrary[API Development](/categories/api)

vormiaphp/vormiaqueryphp
========================

Laravel middleware and helpers for VormiaQuery encrypted API

v1.1.0(1y ago)06MITPHPPHP &gt;=8.0CI passing

Since Jul 1Pushed 1y agoCompare

[ Source](https://github.com/vormiaphp/vormiaqueryphp)[ Packagist](https://packagist.org/packages/vormiaphp/vormiaqueryphp)[ RSS](/packages/vormiaphp-vormiaqueryphp/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (2)Versions (5)Used By (0)

vormiaqueryphp
==============

[](#vormiaqueryphp)

[![Packagist](https://camo.githubusercontent.com/4dd935b1c39861d3260dc50de1ec8013623fdb46388980aa1d1c83e7cc1e4357/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766f726d69617068702f766f726d696171756572797068702e737667)](https://packagist.org/packages/vormiaphp/vormiaqueryphp)[![GitHub](https://camo.githubusercontent.com/ef13abe2b51d067567c0613707573753d6810ee4a58de5f023c7f314162035e1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f766f726d69617068702f766f726d696171756572797068702e737667)](https://github.com/vormiaphp/vormiaqueryphp)

Laravel middleware and helpers for VormiaQuery encrypted API integration.

Installation
------------

[](#installation)

### Using Artisan Command (Recommended)

[](#using-artisan-command-recommended)

1. Install via Composer:

```
composer require vormiaphp/vormiaqueryphp
composer require phpseclib/phpseclib
```

2. Run the installation command:

```
php artisan vormiaquery:install
```

This command will:

- Prompt you to install Sanctum API features if not already installed (Laravel 12+)
- Add VormiaQuery environment variables to your `.env` and `.env.example` files
- Prompt you to publish CORS configuration if not already published

You will be interactively asked to run:

- `php artisan install:api` (for Sanctum)
- `php artisan vendor:publish --tag=cors` (for CORS)

3. Add your RSA keys to `.env`:

```
VORMIA_PRIVATE_KEY=""
VORMIA_PUBLIC_KEY=""
```

### Uninstallation

[](#uninstallation)

To remove VormiaQuery integration:

```
php artisan vormiaquery:uninstall
```

This command will:

- Remove VormiaQuery environment variables from `.env` and `.env.example` files
- Remove CORS configuration file

### Update

[](#update)

To update VormiaQuery integration (re-run setup steps):

```
php artisan vormiaquery:update
```

This command will:

- Re-apply environment variables and configuration as needed
- Prompt for any new setup steps in future versions

---

**Note:**

- There is currently no separate `update` command. Use the install command to re-run setup steps as needed.

JavaScript Client Package
-------------------------

[](#javascript-client-package)

For optimal performance and RSA encryption support, install the companion JavaScript package:

```
npm install vormiaqueryjs
```

For complete documentation and examples, visit:

- [GitHub Repository](https://github.com/vormiaphp/vormiaqueryjs)
- [NPM Package](https://www.npmjs.com/package/vormiaqueryjs)

Middleware Usage
----------------

[](#middleware-usage)

Register the middleware in your `app/Http/Kernel.php`:

```
protected $routeMiddleware = [
    // ...
    $middleware->alias([
        'vormia.decrypt' => \VormiaQueryPhp\Http\Middleware\DecryptVormiaRequest::class,
        'vormia.encrypt' => \VormiaQueryPhp\Http\Middleware\EncryptVormiaResponse::class,
    ]);
];
```

Apply the middleware to your API routes:

```
Route::middleware(['vormia.decrypt', 'vormia.encrypt'])->group(function () {
    Route::post('/vormia/data', [\VormiaQueryPhp\Http\Controllers\VormiaQueryController::class, 'loadData']);
});
```

Example Controller
------------------

[](#example-controller)

```
namespace VormiaQueryPhp\Http\Controllers;

use Illuminate\Routing\Controller;
use Illuminate\Http\Request;

class VormiaQueryController extends Controller
{
    public function loadData(Request $request)
    {
        $data = [
            ['id' => 1, 'name' => 'Alpha'],
            ['id' => 2, 'name' => 'Beta'],
        ];

        $response = [
            'response' => $data,
            'message' => 'Success',
            'meta' => [
                'total' => count($data),
                'page' => 1,
                'perPage' => count($data),
            ],
        ];

        return response()->json($response);
    }
}
```

How It Works
------------

[](#how-it-works)

- **DecryptVormiaRequest**: Decrypts incoming requests with the private key if an `encrypted` field is present.
- **EncryptVormiaResponse**: Encrypts outgoing responses with the public key if the request expects encryption (via header or flag).
- **Standard VormiaQuery Response**: Always return data in the format: ```
    {
      "response": [...],
      "message": "Success",
      "meta": { "total": 2, "page": 1, "perPage": 2 }
    }
    ```

Security
--------

[](#security)

- Never expose your private key in frontend/browser code.
- Rotate keys as needed and keep them secure.

Security Helper Examples
------------------------

[](#security-helper-examples)

### 1. Domain Whitelisting

[](#1-domain-whitelisting)

```
use VormiaQueryPhp\Helpers\VormiaSecurityHelper;

if (!VormiaSecurityHelper::isDomainAllowed()) {
    abort(403, 'Domain not allowed');
}
```

### 2. API Token Validation

[](#2-api-token-validation)

```
use VormiaQueryPhp\Helpers\VormiaSecurityHelper;

if (!VormiaSecurityHelper::validateApiToken()) {
    abort(401, 'Invalid API token');
}
```

### 3. User Role and Ability Checks

[](#3-user-role-and-ability-checks)

```
use VormiaQueryPhp\Helpers\VormiaSecurityHelper;

if (!VormiaSecurityHelper::userHasRole('admin')) {
    abort(403, 'Admin role required');
}

if (!VormiaSecurityHelper::userCan('edit-posts')) {
    abort(403, 'Permission denied');
}
```

### 4. Rate Limiting

[](#4-rate-limiting)

```
use VormiaQueryPhp\Helpers\VormiaSecurityHelper;

$key = request()->ip(); // or use Auth::id() for user-based
if (!VormiaSecurityHelper::rateLimit($key, 10, 60)) {
    abort(429, 'Too many requests');
}
```

### 5. IP Whitelisting

[](#5-ip-whitelisting)

```
use VormiaQueryPhp\Helpers\VormiaSecurityHelper;

if (!VormiaSecurityHelper::isIpAllowed()) {
    abort(403, 'IP not allowed');
}
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance50

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

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

Total

4

Last Release

366d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f69b40bdd7f381ee33360299b1d574f9d9d0af369f7e3d925f7ac2e5d70403aa?d=identicon)[joshlminga](/maintainers/joshlminga)

---

Top Contributors

[![joshlminga](https://avatars.githubusercontent.com/u/7943555?v=4)](https://github.com/joshlminga "joshlminga (10 commits)")

---

Tags

phpapilaravelvormiavormiaqueryphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vormiaphp-vormiaqueryphp/health.svg)

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

###  Alternatives

[joisarjignesh/bigbluebutton

BigBlueButton Server API Library for Laravel

162155.1k1](/packages/joisarjignesh-bigbluebutton)[comgate/sdk

Comgate PHP SDK

13373.6k](/packages/comgate-sdk)[jeroen-g/flickr

Modern PHP package to make Flickr API calls. Ships with Laravel implementation.

2563.3k2](/packages/jeroen-g-flickr)[exlo89/laravel-sevdesk-api

A helpful Sevdesk API client for Laravel.

1118.4k](/packages/exlo89-laravel-sevdesk-api)[dystcz/lunar-api

Dystore API layer for Lunar e-commerce package

411.2k3](/packages/dystcz-lunar-api)[yxx/laravel-quick

agile development

145.6k](/packages/yxx-laravel-quick)

PHPackages © 2026

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