Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Cryptography
  3. PHP Encryption

PHP Encryption

MITPHPv2.4.0

A secure and easy-to-use PHP library for encrypting data with keys or passwords.

GitHubGitHub
3.9k stars309 forks0 contributors

What is PHP Encryption?

php-encryption is a PHP library for encrypting data with keys or passwords, designed to be secure and difficult to misuse. It solves the problem of insecure PHP encryption code commonly encountered in the ecosystem by providing a robust, easy-to-use API. The library ensures data at rest is protected using strong cryptographic practices.

Target Audience

PHP developers who need to encrypt data securely in their applications, such as those handling sensitive user information or file storage. It is particularly useful for developers who may not be cryptography experts but require reliable encryption.

Value Proposition

Developers choose php-encryption because it prioritizes security and ease of use, reducing the risk of common vulnerabilities. Its API is designed to prevent misuse, and it has been extensively reviewed by the PHP security community, making it a trusted alternative to other encryption libraries.

Overview

Simple Encryption in PHP.

Use Cases

Best For

  • Encrypting sensitive user data stored in databases
  • Securing file uploads with password-based encryption
  • Adding encryption to legacy PHP applications securely
  • Protecting configuration files or environment variables
  • Implementing client-server data encryption in PHP backends
  • Educational projects teaching secure PHP encryption practices

Not Ideal For

  • Projects requiring client-side or cross-platform encryption (the library explicitly recommends libsodium for this)
  • Environments mandating formal, paid security audits for compliance (it relies on community review rather than a formal audit)
  • Applications built on modern PHP frameworks with native encryption (e.g., Laravel's built-in encrypter, to avoid redundancy)
  • Systems without OpenSSL support or using outdated OpenSSL versions (<1.0.1)

Pros & Cons

Pros

Secure by Design

Prioritizes security with an API designed to prevent misuse, explicitly stated to address common vulnerabilities in PHP encryption code, similar to libsodium.

Easy-to-Use API

Offers a simple interface for encryption and decryption, encouraging secure patterns without requiring deep cryptography knowledge, as highlighted in the philosophy.

No External Dependencies

Only requires PHP with OpenSSL and bundles random_compat, simplifying installation and reducing maintenance overhead, as noted in the dependencies section.

Password and File Support

Includes dedicated classes like KeyProtectedByPassword for password-based key encryption and File for secure file operations, making it versatile for data at rest.

Cons

No Formal Security Audit

Admits it hasn't undergone a formal, paid audit, relying on community review, which may not satisfy strict regulatory or enterprise security requirements.

PHP Version Constraints

Requires PHP 5.6+ and OpenSSL 1.0.1+, but using unsupported PHP versions (below 8.0) could introduce vulnerabilities, as warned in the README.

Limited Ecosystem Integration

As a standalone library, it lacks built-in integrations with popular PHP frameworks or tools, potentially increasing setup complexity for modern stacks.

Frequently Asked Questions

Quick Stats

Stars3,866
Forks309
Contributors0
Open Issues10
Last commit2 years ago
CreatedSince 2014

Tags

#library#data-protection#file-encryption#encryption#security#password-encryption#cryptography#php#openssl

Built With

O
OpenSSL
P
PHP

Included in

PHP32.5kCryptography6.8k
Auto-fetched 23 hours ago

Related Projects

SQLMapSQLMap

Automatic SQL injection and database takeover tool

Stars37,582
Forks6,275
Last commit1 day ago
ZapZap

The ZAP by Checkmarx Core project

Stars15,234
Forks2,566
Last commit4 days ago
PHPSecLibPHPSecLib

PHP Secure Communications Library

Stars5,573
Forks910
Last commit3 days ago
PHPGGCPHPGGC

PHPGGC is a library of PHP unserialize() payloads along with a tool to generate them, from command line or programmatically.

Stars3,821
Forks551
Last commit8 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub