PHPackages                             cyvax/privatebin\_php - 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. cyvax/privatebin\_php

ActiveLibrary[Security](/categories/security)

cyvax/privatebin\_php
=====================

PHP client library for PrivateBin with client-side encryption and decryption support.

v2.0.0(1mo ago)34.7k3MITPHPPHP &gt;=7.1.0

Since Nov 9Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/cyvax/Privatebin_PHP)[ Packagist](https://packagist.org/packages/cyvax/privatebin_php)[ Docs](https://github.com/cyvax/Privatebin_PHP)[ RSS](/packages/cyvax-privatebin-php/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (3)Dependencies (2)Versions (6)Used By (0)

Privatebin\_PHP
===============

[](#privatebin_php)

[![GitHub License](https://camo.githubusercontent.com/259ea82ce30970d352f49cd9712d4c03aade15bbf4be99b833abb3f1f33c56ea/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f63797661782f5072697661746562696e5f5048503f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/259ea82ce30970d352f49cd9712d4c03aade15bbf4be99b833abb3f1f33c56ea/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f63797661782f5072697661746562696e5f5048503f7374796c653d666f722d7468652d6261646765)[![version](https://camo.githubusercontent.com/162c09719547bc8cb108b00cfbba8f2e6fd9a5ebbdf81b7b49b877a14a26b6d8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f63797661782f5072697661746562696e5f5048503f6c6162656c3d56455253494f4e267374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/162c09719547bc8cb108b00cfbba8f2e6fd9a5ebbdf81b7b49b877a14a26b6d8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f63797661782f5072697661746562696e5f5048503f6c6162656c3d56455253494f4e267374796c653d666f722d7468652d6261646765)[![packagist](https://camo.githubusercontent.com/7113e5b55c5fc5eaa752ef4b8014d04d46de9b6e460f737d0f41513cb1be00f6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63797661782f7072697661746562696e5f7068703f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/7113e5b55c5fc5eaa752ef4b8014d04d46de9b6e460f737d0f41513cb1be00f6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63797661782f7072697661746562696e5f7068703f7374796c653d666f722d7468652d6261646765)[![Packagist PHP Version Support](https://camo.githubusercontent.com/1058f715690fd1e27e422da06692b8372d2a62703a9f78bbd999a86009d74b7e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f63797661782f7072697661746562696e5f7068703f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/1058f715690fd1e27e422da06692b8372d2a62703a9f78bbd999a86009d74b7e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f63797661782f7072697661746562696e5f7068703f7374796c653d666f722d7468652d6261646765)[![Codacy grade](https://camo.githubusercontent.com/ba58ae0fdc6af5d3709a06b2e3f0bbf272c94178402c086cf98d1bc51065c406/68747470733a2f2f696d672e736869656c64732e696f2f636f646163792f67726164652f31336262633862653064313334313830623832323166303134616635306537343f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/ba58ae0fdc6af5d3709a06b2e3f0bbf272c94178402c086cf98d1bc51065c406/68747470733a2f2f696d672e736869656c64732e696f2f636f646163792f67726164652f31336262633862653064313334313830623832323166303134616635306537343f7374796c653d666f722d7468652d6261646765)

PHP client library for [PrivateBin](https://github.com/PrivateBin/PrivateBin/).

Supports:

- Modern camelCase API (`PrivatebinPHP`)
- Original snake\_case API (`PrivatebinSnakeCase`)
- Optional pipe-style helpers (`PrivatebinPHPPipe`)
- Attachments
- Password-protected pastes
- Burn-after-reading
- Discussions
- Compression
- Custom formatters
- SSL verification control
- PHP 7.1+ compatibility

---

Installation
============

[](#installation)

```
composer require cyvax/privatebin_php
```

---

Default Instance
================

[](#default-instance)

By default, the library is configured to use:

```
https://paste.i2pd.xyz/

```

You can override it with `setUrl()` or via constructor options.

---

Usage
=====

[](#usage)

Modern camelCase API
--------------------

[](#modern-camelcase-api)

```
use Cyvax\Clients\Privatebin;

$result = (new Privatebin())
    ->setUrl("https://privatebin.net/")
    ->setText("Because ignorance is bliss!")
    ->setExpire("1hour")
    ->encodeAndPost();
```

### Factory method

[](#factory-method)

`PrivatebinPHP::init()` supports named parameters for a more concise setup on PHP 8+:

```
use Cyvax\Clients\Privatebin;

$result = Privatebin::init(
    url: "https://privatebin.net/",
    text: "Because ignorance is bliss!",
    expire: "1hour",
)->encodeAndPost();
```

---

Original snake\_case API
------------------------

[](#original-snake_case-api)

```
use Cyvax\Clients\PrivatebinSnakeCase;

$result = (new PrivatebinSnakeCase())
    ->set_url("https://privatebin.net/")
    ->set_text("Because ignorance is bliss!")
    ->set_expire("1hour")
    ->encode_and_post();
```

Note

`PrivatebinSnakeCase` is also available as the alias `\Cyvax\PrivatebinPHP`for compatibility with older versions of the library.

---

Constructor Options
-------------------

[](#constructor-options)

Both clients accept an options array in their constructor:

```
use Cyvax\Clients\Privatebin;

$result = (new Privatebin([
    "url"  => "https://privatebin.net/",
    "text" => "Because ignorance is bliss!",
]))->encodeAndPost();
```

---

Attachments
-----------

[](#attachments)

```
use Cyvax\Clients\Privatebin;

$result = (new Privatebin())
    ->setAttachment("/path/to/image.png")
    ->encodeAndPost();
```

Note

`setAttachment()` throws `PrivatebinException` if the file cannot be read.

An optional second argument overrides the attachment filename:

```
->setAttachment("/path/to/image.png", "screenshot.png")
```

---

SSL Verification
----------------

[](#ssl-verification)

SSL verification is enabled by default. Disable it only for local or self-signed instances:

```
use Cyvax\Clients\Privatebin;

$result = (new Privatebin())
    ->setUrl("https://local.privatebin/")
    ->setSslVerify(false)
    ->setText("Hello!")
    ->encodeAndPost();
```

The `ssl_verify` key is also accepted in the constructor options array and in `PrivatebinPHP::init()`.

---

Pipe-style API
--------------

[](#pipe-style-api)

`PrivatebinPHPPipe` provides functional-style helper closures.

On PHP versions supporting the pipe operator:

```
use Cyvax\Clients\PrivatebinPipe;

$result = PrivatebinPipe::init("https://privatebin.net/")
    |> PrivatebinPipe::text("Hello!")
    |> PrivatebinPipe::expire("1hour")
    |> PrivatebinPipe::encodeAndPost();
```

Without pipe support, it is recommended to use `PrivatebinPHP` or `PrivatebinSnakeCase` directly.

If needed, closures can still be invoked manually:

```
use Cyvax\Clients\PrivatebinPipe;

$client = PrivatebinPipe::init("https://privatebin.net/");

$client = PrivatebinPipe::text("Hello!")($client);
$client = PrivatebinPipe::expire("1hour")($client);

$result = PrivatebinPipe::encodeAndPost()($client);
```

---

Fetching and Decrypting
-----------------------

[](#fetching-and-decrypting)

```
use Cyvax\Clients\Privatebin;

$client = new Privatebin();

// Fetch and decrypt in one call
$data = $client->fetchAndDecrypt($pasteId, $b58);

echo $data['paste'];
// $data['attachment'] and $data['attachment_name'] are set if the paste had an attachment
```

---

Interfaces
==========

[](#interfaces)

InterfaceNamespaceUsed by`PrivatebinClientInterface``Cyvax\Contracts``PrivatebinPHP` (camelCase)`PrivatebinSnakeCaseClientInterface``Cyvax\Contracts``PrivatebinSnakeCase`Type-hint against an interface when you want to swap implementations:

```
use Cyvax\Contracts\PrivatebinClientInterface;

function postPaste(PrivatebinClientInterface $client): array {
    return $client->setText("Hello!")->encodeAndPost();
}
```

---

Features
========

[](#features)

- AES-256-GCM encryption
- PBKDF2 SHA-256 key derivation
- Zlib compression support
- Attachments support
- Password-protected pastes
- Burn-after-reading support
- Discussions support
- Multiple formatter support
- SSL verification control
- Fluent API
- Functional pipe helpers
- PHP 7.1+ compatible

---

Documentation
=============

[](#documentation)

See the [Wiki](https://github.com/cyvax/Privatebin_PHP/wiki) for full documentation.

---

License
=======

[](#license)

This project is licensed under the MIT license.

See [LICENSE](https://github.com/cyvax/Privatebin_PHP/blob/master/LICENSE).

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance94

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.6% 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 ~505 days

Total

5

Last Release

30d ago

Major Versions

v1.1.2.x-dev → v2.0.02026-05-23

### Community

Maintainers

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

---

Top Contributors

[![cyvax](https://avatars.githubusercontent.com/u/27162110?v=4)](https://github.com/cyvax "cyvax (56 commits)")[![nhoag](https://avatars.githubusercontent.com/u/1390106?v=4)](https://github.com/nhoag "nhoag (11 commits)")

---

Tags

encryptionpasteprivatebin

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cyvax-privatebin-php/health.svg)

```
[![Health](https://phpackages.com/badges/cyvax-privatebin-php/health.svg)](https://phpackages.com/packages/cyvax-privatebin-php)
```

###  Alternatives

[phpseclib/phpseclib

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

5.6k455.2M1.5k](/packages/phpseclib-phpseclib)[defuse/php-encryption

Secure PHP Encryption Library

3.9k170.7M239](/packages/defuse-php-encryption)[paragonie/ciphersweet

Searchable field-level encryption library for relational databases

4661.3M23](/packages/paragonie-ciphersweet)[ass/xmlsecurity

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

955.6M33](/packages/ass-xmlsecurity)[pear/crypt_gpg

Provides an object oriented interface to the GNU Privacy Guard (GnuPG). It requires the GnuPG executable to be on the system.

954.5M12](/packages/pear-crypt-gpg)[soved/laravel-gdpr

GDPR compliance with ease

299134.1k2](/packages/soved-laravel-gdpr)

PHPackages © 2026

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