PHPackages                             archwisp/php-crypt - 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. archwisp/php-crypt

ActiveLibrary[Security](/categories/security)

archwisp/php-crypt
==================

Simple Data Encryption Library For PHP 5.3+

1.1.0(10y ago)18299[3 issues](https://github.com/archwisp/PHPCrypt/issues)MITPHP

Since Nov 19Pushed 10y ago5 watchersCompare

[ Source](https://github.com/archwisp/PHPCrypt)[ Packagist](https://packagist.org/packages/archwisp/php-crypt)[ RSS](/packages/archwisp-php-crypt/feed)WikiDiscussions master Synced 3d ago

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

\\PHPEncryptData\\ - Simple Data Encryption Library For PHP 5.3+
================================================================

[](#phpencryptdata---simple-data-encryption-library-for-php-53)

[![Build Status](https://camo.githubusercontent.com/dab9ef1676f75b9bd88e9ff20e1eea3110d3ffce06c34c11fadabedcfa973ecf/68747470733a2f2f7472617669732d63692e6f72672f61726368776973702f504850456e6372797074446174612e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/archwisp/PHPEncryptData) [![Coverage Status](https://camo.githubusercontent.com/98834d32fcbaed773629a9c896312dc1209feb31536213c881b3a16591783ccf/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f61726368776973702f504850456e6372797074446174612e737667)](https://coveralls.io/r/archwisp/PHPEncryptData)

If you are looking for the answer to the question, "How do I encrypt sensitive data in PHP?", you are in the correct place. Read through this README, execute a couple of commands, write about four lines of code, and you will have secure encryption.

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

[](#installation)

Install via Composer:

1. [Download Composer](http://getcomposer.org/download/) using your preferred method.
2. Add PHPEncryptData to your project:

    ```
     $ php composer.phar require archwisp/php-encrypt-data

    ```

Basic Usage
-----------

[](#basic-usage)

1. Generate your encryption key:

    ```
     $ head -c 32 /dev/urandom | base64
     6zp4y5vnUQpfEroWI6dMq5lC46F5Dmqa4NDcM1W42k=

    ```
2. Generate your MAC key:

    ```
     $ head -c 32 /dev/urandom | base64
     RJikKksPg3UmqgQPXBwCmcSOMHQn0iOtQAFcfcQOTU=

    ```
3. Write your code:

    ```
