16 best PHP Encryption libraries in 2024

share link

by sureshbabu dot icon Updated: Dec 9, 2022

technology logo
technology logo

Guide Kit Guide Kit  

Build safer and secure applications in PHP with features like password hashing, secret key encryption, envelope encryption, password storage, whole-file cryptography, and more using PHP encryption libraries.


Essentially password encrypting in PHP works by hashing them with an appropriate password-hashing algorithm. The primary security functions offered by PHP encryption and cryptographic libraries include Symmetric and Asymmetric key authenticated encryption, anonymous encryption, digital signatures, cryptographic hash functions, RSA Encryption, RSA Signatures, and key decryption. Using these libraries, you can generate an ephemeral encryption key to encrypt your message with PHP symmetric-key encryption. And then, decrypt the ephemeral key with the correct RSA private key.


Check out the below list to find more trending PHP encryption libraries to add security functions to your applications:


The php-encryption library employs simple yet effective encryption methods. This library is extremely useful for securely encrypting data with a key or password in PHP.

PHP doticonstar image 3626 doticonVersion:v2.3.1doticon
License: Permissive (MIT)

Simple Encryption in PHP.

Support
    Quality
      Security
        License
          Reuse

            php-encryptionby defuse

            PHP doticon star image 3626 doticonVersion:v2.3.1doticon License: Permissive (MIT)

            Simple Encryption in PHP.
            Support
              Quality
                Security
                  License
                    Reuse


                      libsodium is one of the world’s most reliable, cross-platform cryptography libraries. It offers numerous functionalities making it extremely popular among developers.

                      libsodiumby picocodes

                      PHP doticonstar image 0 doticonVersion:Currentdoticon
                      no licences License: No License (null)

                      Support
                        Quality
                          Security
                            License
                              Reuse

                                libsodiumby picocodes

                                PHP doticon star image 0 doticonVersion:Currentdoticonno licences License: No License

                                Support
                                  Quality
                                    Security
                                      License
                                        Reuse


                                          Halite is a comprehensive high-level cryptography library that offers all the functions of libsodium with a simple and intuitive interface.

                                          haliteby paragonie

                                          PHP doticonstar image 1082 doticonVersion:v5.1.0doticon
                                          License: Weak Copyleft (MPL-2.0)

                                          High-level cryptography interface powered by libsodium

                                          Support
                                            Quality
                                              Security
                                                License
                                                  Reuse

                                                    haliteby paragonie

                                                    PHP doticon star image 1082 doticonVersion:v5.1.0doticon License: Weak Copyleft (MPL-2.0)

                                                    High-level cryptography interface powered by libsodium
                                                    Support
                                                      Quality
                                                        Security
                                                          License
                                                            Reuse

                                                              PrivateBinby PrivateBin

                                                              PHP doticonstar image 5068 doticonVersion:1.5.1doticon
                                                              License: Others (Non-SPDX)

                                                              A minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted in the browser using 256 bits AES.

                                                              Support
                                                                Quality
                                                                  Security
                                                                    License
                                                                      Reuse

                                                                        PrivateBinby PrivateBin

                                                                        PHP doticon star image 5068 doticonVersion:1.5.1doticon License: Others (Non-SPDX)

                                                                        A minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted in the browser using 256 bits AES.
                                                                        Support
                                                                          Quality
                                                                            Security
                                                                              License
                                                                                Reuse

                                                                                  easyengineby EasyEngine

                                                                                  PHP doticonstar image 2008 doticonVersion:v4.6.6doticon
                                                                                  License: Permissive (MIT)

                                                                                  Command-line control panel for Nginx Server to manage WordPress sites running on Nginx, PHP, MySQL, and Let's Encrypt

                                                                                  Support
                                                                                    Quality
                                                                                      Security
                                                                                        License
                                                                                          Reuse

                                                                                            easyengineby EasyEngine

                                                                                            PHP doticon star image 2008 doticonVersion:v4.6.6doticon License: Permissive (MIT)

                                                                                            Command-line control panel for Nginx Server to manage WordPress sites running on Nginx, PHP, MySQL, and Let's Encrypt
                                                                                            Support
                                                                                              Quality
                                                                                                Security
                                                                                                  License
                                                                                                    Reuse

                                                                                                      joseby namshi

                                                                                                      PHP doticonstar image 1756 doticonVersion:Currentdoticon
                                                                                                      License: Permissive (MIT)

                                                                                                      JSON Object Signing and Encryption library for PHP.

                                                                                                      Support
                                                                                                        Quality
                                                                                                          Security
                                                                                                            License
                                                                                                              Reuse

                                                                                                                joseby namshi

                                                                                                                PHP doticon star image 1756 doticonVersion:Currentdoticon License: Permissive (MIT)

                                                                                                                JSON Object Signing and Encryption library for PHP.
                                                                                                                Support
                                                                                                                  Quality
                                                                                                                    Security
                                                                                                                      License
                                                                                                                        Reuse

                                                                                                                          phpbuby sebastianfeldmann

                                                                                                                          PHP doticonstar image 1235 doticonVersion:6.0.15doticon
                                                                                                                          License: Others (Non-SPDX)

                                                                                                                          PHP Backup Utility - Creates and encrypts database and file backups, syncs your backups to other servers or cloud services and assists you monitor your backup process

                                                                                                                          Support
                                                                                                                            Quality
                                                                                                                              Security
                                                                                                                                License
                                                                                                                                  Reuse

                                                                                                                                    phpbuby sebastianfeldmann

                                                                                                                                    PHP doticon star image 1235 doticonVersion:6.0.15doticon License: Others (Non-SPDX)

                                                                                                                                    PHP Backup Utility - Creates and encrypts database and file backups, syncs your backups to other servers or cloud services and assists you monitor your backup process
                                                                                                                                    Support
                                                                                                                                      Quality
                                                                                                                                        Security
                                                                                                                                          License
                                                                                                                                            Reuse

                                                                                                                                              sodium_compatby paragonie

                                                                                                                                              PHP doticonstar image 793 doticonVersion:v1.17.1doticon
                                                                                                                                              License: Permissive (ISC)

                                                                                                                                              Pure PHP polyfill for ext/sodium

                                                                                                                                              Support
                                                                                                                                                Quality
                                                                                                                                                  Security
                                                                                                                                                    License
                                                                                                                                                      Reuse

                                                                                                                                                        sodium_compatby paragonie

                                                                                                                                                        PHP doticon star image 793 doticonVersion:v1.17.1doticon License: Permissive (ISC)

                                                                                                                                                        Pure PHP polyfill for ext/sodium
                                                                                                                                                        Support
                                                                                                                                                          Quality
                                                                                                                                                            Security
                                                                                                                                                              License
                                                                                                                                                                Reuse

                                                                                                                                                                  acmephpby acmephp

                                                                                                                                                                  PHP doticonstar image 538 doticonVersion:2.1.0doticon
                                                                                                                                                                  License: Permissive (MIT)

                                                                                                                                                                  Let's Encrypt/ACME Command Line client written in PHP

                                                                                                                                                                  Support
                                                                                                                                                                    Quality
                                                                                                                                                                      Security
                                                                                                                                                                        License
                                                                                                                                                                          Reuse

                                                                                                                                                                            acmephpby acmephp

                                                                                                                                                                            PHP doticon star image 538 doticonVersion:2.1.0doticon License: Permissive (MIT)

                                                                                                                                                                            Let's Encrypt/ACME Command Line client written in PHP
                                                                                                                                                                            Support
                                                                                                                                                                              Quality
                                                                                                                                                                                Security
                                                                                                                                                                                  License
                                                                                                                                                                                    Reuse
                                                                                                                                                                                      PHP doticonstar image 400 doticonVersion:v1.1.0doticon
                                                                                                                                                                                      License: Permissive (MIT)

                                                                                                                                                                                      Encrypt and authenticate PHP session data using AES-256 and HMAC-SHA256

                                                                                                                                                                                      Support
                                                                                                                                                                                        Quality
                                                                                                                                                                                          Security
                                                                                                                                                                                            License
                                                                                                                                                                                              Reuse

                                                                                                                                                                                                PHP-Secure-Sessionby ezimuel

                                                                                                                                                                                                PHP doticon star image 400 doticonVersion:v1.1.0doticon License: Permissive (MIT)

                                                                                                                                                                                                Encrypt and authenticate PHP session data using AES-256 and HMAC-SHA256
                                                                                                                                                                                                Support
                                                                                                                                                                                                  Quality
                                                                                                                                                                                                    Security
                                                                                                                                                                                                      License
                                                                                                                                                                                                        Reuse

                                                                                                                                                                                                          enphpby djunny

                                                                                                                                                                                                          PHP doticonstar image 363 doticonVersion:Currentdoticon
                                                                                                                                                                                                          License: Strong Copyleft (GPL-3.0)

                                                                                                                                                                                                          a Open Source PHP Code Confusion + Encryption Project

                                                                                                                                                                                                          Support
                                                                                                                                                                                                            Quality
                                                                                                                                                                                                              Security
                                                                                                                                                                                                                License
                                                                                                                                                                                                                  Reuse

                                                                                                                                                                                                                    enphpby djunny

                                                                                                                                                                                                                    PHP doticon star image 363 doticonVersion:Currentdoticon License: Strong Copyleft (GPL-3.0)

                                                                                                                                                                                                                    a Open Source PHP Code Confusion + Encryption Project
                                                                                                                                                                                                                    Support
                                                                                                                                                                                                                      Quality
                                                                                                                                                                                                                        Security
                                                                                                                                                                                                                          License
                                                                                                                                                                                                                            Reuse

                                                                                                                                                                                                                              acme-clientby kelunik

                                                                                                                                                                                                                              PHP doticonstar image 342 doticonVersion:v0.3.0-beta.4doticon
                                                                                                                                                                                                                              License: Permissive (MIT)

                                                                                                                                                                                                                              Let's Encrypt / ACME client written in PHP for the CLI.

                                                                                                                                                                                                                              Support
                                                                                                                                                                                                                                Quality
                                                                                                                                                                                                                                  Security
                                                                                                                                                                                                                                    License
                                                                                                                                                                                                                                      Reuse

                                                                                                                                                                                                                                        acme-clientby kelunik

                                                                                                                                                                                                                                        PHP doticon star image 342 doticonVersion:v0.3.0-beta.4doticon License: Permissive (MIT)

                                                                                                                                                                                                                                        Let's Encrypt / ACME client written in PHP for the CLI.
                                                                                                                                                                                                                                        Support
                                                                                                                                                                                                                                          Quality
                                                                                                                                                                                                                                            Security
                                                                                                                                                                                                                                              License
                                                                                                                                                                                                                                                Reuse

                                                                                                                                                                                                                                                  cryptoby spatie

                                                                                                                                                                                                                                                  PHP doticonstar image 398 doticonVersion:2.0.2doticon
                                                                                                                                                                                                                                                  License: Permissive (MIT)

                                                                                                                                                                                                                                                  Encrypt and decrypt data using private/public keys

                                                                                                                                                                                                                                                  Support
                                                                                                                                                                                                                                                    Quality
                                                                                                                                                                                                                                                      Security
                                                                                                                                                                                                                                                        License
                                                                                                                                                                                                                                                          Reuse

                                                                                                                                                                                                                                                            cryptoby spatie

                                                                                                                                                                                                                                                            PHP doticon star image 398 doticonVersion:2.0.2doticon License: Permissive (MIT)

                                                                                                                                                                                                                                                            Encrypt and decrypt data using private/public keys
                                                                                                                                                                                                                                                            Support
                                                                                                                                                                                                                                                              Quality
                                                                                                                                                                                                                                                                Security
                                                                                                                                                                                                                                                                  License
                                                                                                                                                                                                                                                                    Reuse

                                                                                                                                                                                                                                                                      sapientby paragonie

                                                                                                                                                                                                                                                                      PHP doticonstar image 310 doticonVersion:v1.1.0doticon
                                                                                                                                                                                                                                                                      License: Permissive (MIT)

                                                                                                                                                                                                                                                                      Secure API Toolkit

                                                                                                                                                                                                                                                                      Support
                                                                                                                                                                                                                                                                        Quality
                                                                                                                                                                                                                                                                          Security
                                                                                                                                                                                                                                                                            License
                                                                                                                                                                                                                                                                              Reuse

                                                                                                                                                                                                                                                                                sapientby paragonie

                                                                                                                                                                                                                                                                                PHP doticon star image 310 doticonVersion:v1.1.0doticon License: Permissive (MIT)

                                                                                                                                                                                                                                                                                Secure API Toolkit
                                                                                                                                                                                                                                                                                Support
                                                                                                                                                                                                                                                                                  Quality
                                                                                                                                                                                                                                                                                    Security
                                                                                                                                                                                                                                                                                      License
                                                                                                                                                                                                                                                                                        Reuse

                                                                                                                                                                                                                                                                                          ciphersweetby paragonie

                                                                                                                                                                                                                                                                                          PHP doticonstar image 384 doticonVersion:v4.3.0doticon
                                                                                                                                                                                                                                                                                          License: Others (Non-SPDX)

                                                                                                                                                                                                                                                                                          Fast, searchable field-level encryption for PHP projects

                                                                                                                                                                                                                                                                                          Support
                                                                                                                                                                                                                                                                                            Quality
                                                                                                                                                                                                                                                                                              Security
                                                                                                                                                                                                                                                                                                License
                                                                                                                                                                                                                                                                                                  Reuse

                                                                                                                                                                                                                                                                                                    ciphersweetby paragonie

                                                                                                                                                                                                                                                                                                    PHP doticon star image 384 doticonVersion:v4.3.0doticon License: Others (Non-SPDX)

                                                                                                                                                                                                                                                                                                    Fast, searchable field-level encryption for PHP projects
                                                                                                                                                                                                                                                                                                    Support
                                                                                                                                                                                                                                                                                                      Quality
                                                                                                                                                                                                                                                                                                        Security
                                                                                                                                                                                                                                                                                                          License
                                                                                                                                                                                                                                                                                                            Reuse

                                                                                                                                                                                                                                                                                                              phpeccby phpecc

                                                                                                                                                                                                                                                                                                              PHP doticonstar image 300 doticonVersion:Currentdoticon
                                                                                                                                                                                                                                                                                                              no licences License: No License (null)

                                                                                                                                                                                                                                                                                                              Pure PHP Elliptic Curve Cryptography Library

                                                                                                                                                                                                                                                                                                              Support
                                                                                                                                                                                                                                                                                                                Quality
                                                                                                                                                                                                                                                                                                                  Security
                                                                                                                                                                                                                                                                                                                    License
                                                                                                                                                                                                                                                                                                                      Reuse

                                                                                                                                                                                                                                                                                                                        phpeccby phpecc

                                                                                                                                                                                                                                                                                                                        PHP doticon star image 300 doticonVersion:Currentdoticonno licences License: No License

                                                                                                                                                                                                                                                                                                                        Pure PHP Elliptic Curve Cryptography Library
                                                                                                                                                                                                                                                                                                                        Support
                                                                                                                                                                                                                                                                                                                          Quality
                                                                                                                                                                                                                                                                                                                            Security
                                                                                                                                                                                                                                                                                                                              License
                                                                                                                                                                                                                                                                                                                                Reuse

                                                                                                                                                                                                                                                                                                                                  cryptojs-aes-phpby brainfoolong

                                                                                                                                                                                                                                                                                                                                  PHP doticonstar image 351 doticonVersion:2.1.1doticon
                                                                                                                                                                                                                                                                                                                                  License: Permissive (MIT)

                                                                                                                                                                                                                                                                                                                                  CryptoJS 3.x AES encryption/decryption on client side with Javascript and on server side with PHP

                                                                                                                                                                                                                                                                                                                                  Support
                                                                                                                                                                                                                                                                                                                                    Quality
                                                                                                                                                                                                                                                                                                                                      Security
                                                                                                                                                                                                                                                                                                                                        License
                                                                                                                                                                                                                                                                                                                                          Reuse

                                                                                                                                                                                                                                                                                                                                            cryptojs-aes-phpby brainfoolong

                                                                                                                                                                                                                                                                                                                                            PHP doticon star image 351 doticonVersion:2.1.1doticon License: Permissive (MIT)

                                                                                                                                                                                                                                                                                                                                            CryptoJS 3.x AES encryption/decryption on client side with Javascript and on server side with PHP
                                                                                                                                                                                                                                                                                                                                            Support
                                                                                                                                                                                                                                                                                                                                              Quality
                                                                                                                                                                                                                                                                                                                                                Security
                                                                                                                                                                                                                                                                                                                                                  License
                                                                                                                                                                                                                                                                                                                                                    Reuse