PHPackages                             mojahed/jilapi - 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. [Security](/categories/security)
4. /
5. mojahed/jilapi

ActiveLibrary[Security](/categories/security)

mojahed/jilapi
==============

PHP wrapper for the jilapi binary encryption for strings and files.

1.0.0(1mo ago)03MITPHPPHP &gt;=7.4

Since Jul 14Pushed 1mo agoCompare

[ Source](https://github.com/md-mojahed/php-jilapi)[ Packagist](https://packagist.org/packages/mojahed/jilapi)[ RSS](/packages/mojahed-jilapi/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (2)Used By (0)

🔐 mojahed/jilapi
================

[](#-mojahedjilapi)

PHP wrapper for the **jilapi** binary fast secure encryption for strings and files.

> Made with ❤️ by [md-mojahed.github.io](https://md-mojahed.github.io)

---

Requirements
------------

[](#requirements)

- PHP &gt;= 7.4
- The `jilapi` binary installed and executable

Install
-------

[](#install)

```
composer require mojahed/jilapi
```

Usage
-----

[](#usage)

```
use Mojahed\Jilapi;

// absolute path, or omit to assume `jilapi` is on your PATH
$j = Jilapi::setPath('/usr/local/bin/jilapi');
```

### Symmetric (password)

[](#symmetric-password)

```
$b64 = $j->encryptText('hello world', 'mypassword');
$pt  = $j->decryptText($b64, 'mypassword');   // raw bytes
```

### Asymmetric (public/private key) + signing

[](#asymmetric-publicprivate-key--signing)

```
$recipient = $j->keygen();   // ['priv' => ..., 'pub' => ...]
$sender    = $j->keygen();

// encrypt TO recipient, signed BY sender
$b64 = $j->encryptTextAsym('secret', $recipient['pub'], $sender['priv']);

// decrypt WITH recipient's key, verifying sender's signature
$pt = $j->decryptTextAsym($b64, $recipient['priv'], $sender['pub']);

// omit the 3rd arg to decrypt without verifying (jilapi will warn)
$pt = $j->decryptTextAsym($b64, $recipient['priv']);
```

> Asymmetric mode uses the same key-agreement primitives as TLS 1.3 (X25519 + HKDF). Signing is **optional** — without it, you get confidentiality only, not sender authenticity.

### Files

[](#files)

```
// symmetric
$j->encryptFile('./secret.zip', 'mypassword');              // -> secret.zip.jilapi
$j->decryptFile('./secret.zip.jilapi', 'mypassword');       // -> secret.zip

// custom output + overwrite
$j->encryptFile('./data.db', 'k', './data.enc', true);
$j->decryptFile('./data.enc', 'k', './data.db', true);

// asymmetric (+ optional signing)
$j->encryptFileAsym('./secret.zip', './recipient.pub', null, './sender.priv');
$j->decryptFileAsym('./secret.zip.jilapi', './recipient.priv', null, './sender.pub');
```

### Utilities

[](#utilities)

```
$j->inspect('./secret.zip.jilapi');   // header metadata (string)
$j->keygen('/path/mykeys');           // -> ['priv' => ..., 'pub' => ...]
$j->version();                        // "jilapi version v1.0.0"
$j->isAvailable();                    // bool — handy for boot checks
```

Error handling
--------------

[](#error-handling)

All methods throw `RuntimeException` on failure (non-zero exit, wrong key, bad signature, etc.):

```
try {
    $j->decryptText($b64, 'wrong-key');
} catch (\RuntimeException $e) {
    echo $e->getMessage();   // jilapi error (exit 1): decryption failed: wrong key or corrupted data
}
```

Laravel
-------

[](#laravel)

The package has no hard Laravel dependency, so it works anywhere. To use it as a singleton/facade, drop these into your app:

```
// app/Providers/JilapiServiceProvider.php
namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Mojahed\Jilapi;

class JilapiServiceProvider extends ServiceProvider
{
    public function register(): void
    {
        $this->app->singleton('jilapi', function ($app) {
            return Jilapi::setPath(config('services.jilapi_binary', 'jilapi'));
        });
    }
}
```

```
// app/Facades/Jilapi.php  (optional)
namespace App\Facades;

use Illuminate\Support\Facades\Facade;

class Jilapi extends Facade
{
    protected static function getFacadeAccessor(): string
    {
        return 'jilapi';
    }
}
```

Register the provider in `config/app.php`, then:

```
$ct = app('jilapi')->encryptText('hello', 'k');
// or with the facade
\App\Facades\Jilapi::encryptText('hello', 'k');
```

Or bind it in a service container — no provider required:

```
app()->singleton('jilapi', fn () => \Mojahed\Jilapi::setPath('/usr/local/bin/jilapi'));
```

⚠️ Security note
----------------

[](#️-security-note)

jilapi takes the symmetric `--key` as a command-line argument. On **multi-user / shared-host** systems, other users can see process arguments via tools like `ps`. If that applies to you:

- prefer the **asymmetric** mode (no password on the command line), and/or
- run on a single-tenant host / container.

The wrapper itself escapes every argument (`escapeshellarg`) — it is safe from shell injection.

License
-------

[](#license)

MIT

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance90

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity33

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

47d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/92214734?v=4)[Md Mojahedul Islam](/maintainers/md-mojahed)[@md-mojahed](https://github.com/md-mojahed)

---

Top Contributors

[![md-mojahed](https://avatars.githubusercontent.com/u/92214734?v=4)](https://github.com/md-mojahed "md-mojahed (1 commits)")

---

Tags

securityencryptionjilapi

### Embed Badge

![Health badge](/badges/mojahed-jilapi/health.svg)

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

###  Alternatives

[phpseclib/phpseclib

PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.

5.7k487.8M1.7k](/packages/phpseclib-phpseclib)[defuse/php-encryption

Secure PHP Encryption Library

3.9k185.5M287](/packages/defuse-php-encryption)[ass/xmlsecurity

The XmlSecurity library is written in PHP for working with XML Encryption and Signatures

955.7M38](/packages/ass-xmlsecurity)[nzo/url-encryptor-bundle

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

951.1M2](/packages/nzo-url-encryptor-bundle)[tilleuls/url-signer-bundle

Create and validate signed URLs with a limited lifetime in Symfony

80389.8k](/packages/tilleuls-url-signer-bundle)[ercsctt/laravel-file-encryption

Secure file encryption and decryption for Laravel applications

7911.2k1](/packages/ercsctt-laravel-file-encryption)

PHPackages © 2026

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