PHP Encryption Library: Encrypt and decrypt data using adapter classes

Recommend this page to a friend!
  Info   View files Example   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 193 This week: 1All time: 8,410 This week: 341Up
Version License PHP version Categories
php-encryption-class 1.0.0MIT/X Consortium ...5PHP 5, Cryptography
Description Author

This package can encrypt and decrypt data using adapter classes.

It can take data to encrypt with a given key and calls an adapter class that encrypt that data.

It can also decrypt the previously encrypted data with the same adtayer class.

Currently the package provides adapter classes to encrypt and decrypt data using OpenSSL and LibSodium.

Picture of Muhammad Umer Farooq
Name: Muhammad Umer Farooq <contact>
Classes: 46 packages by
Country: Pakistan Pakistan
Innovation award
Innovation award
Nominee: 4x

Details

PHP Encryption

Encryption in PHP.

Requirement

  1. PHP 7 (7.3 Recommanded).
  2. Composer.
  3. openSSL php extension.
  4. Sodium php extension for use sodium adapter.

Insallation

Installing this package is very simple, first ensure you have the right PHP version and composer installed then in your terminal/(command prompt) run:



## Encrypt
You can encrypt string by calling to encrypt method

<?php use Lablnet\Encryption; require '../vendor/autoload.php';

$encryption = new Encryption();

//Encrypt the message $encrypt = $encryption->encrypt("This is a text");

echo $encrypt;


### Decrypt
You can decrypt token by calling decrypt method 

<?php use Lablnet\Encryption; require '../vendor/autoload.php';

$encryption = new Encryption();

//Decrypt the message $decrypt = $encryption->decrypt($encrypt); echo $decrypt;


### Adapter
This Package support two encryption adapter
- OpenSSL
- Sodium

Default openSSL will use,
you can use any one you want.

### change Adapter
You can pass supported adapter to class like

Use of sodium

<?php use Lablnet\Encryption; require '../vendor/autoload.php';

$encryption = new Encryption('sodium');

Use of openSSL

<?php use Lablnet\Encryption; require '../vendor/autoload.php';

$encryption = new Encryption('openssl');

//You can also provide your own key for openSSL $encryption1 = new Encryption('openssl','my-key');

  Files folder image Files  
File Role Description
Files folder imageexample (1 file)
Files folder imagesrc (1 file, 1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file readme.md Doc. Read me

  Files folder image Files  /  example  
File Role Description
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files  /  src  
File Role Description
Files folder imageAdapter (3 files)
  Plain text file Encryption.php Class Class source

  Files folder image Files  /  src  /  Adapter  
File Role Description
  Plain text file AbstractAdapter.php Class Class source
  Plain text file OpenSslEncryption.php Class Class source
  Plain text file SodiumEncryption.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:193
This week:1
All time:8,410
This week:341Up

For more information send a message to info at phpclasses dot org.