PHP Classes

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: 212 All time: 8,340 This week: 571Up
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 is available for providing paid consulting. Contact Muhammad Umer Farooq .
Classes: 52 packages by
Country: Pakistan Pakistan
Age: 22
All time rank: 84611 in Pakistan Pakistan
Week rank: 52 Up3 in Pakistan Pakistan Up
Innovation award
Innovation award
Nominee: 6x

Example

<?php
   
use Lablnet\Encryption;
    require
'../vendor/autoload.php';
   
   
$encryption = new Encryption();
   
   
//Encrypt the message
   
$encrypt = $encryption->encrypt("This is a text");
   
   
var_dump($encrypt);
    echo
"<br\>";
   
   
//Decrypt the message
   
$decrypt = $encryption->decrypt($encrypt);
   
var_dump($decrypt);


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:212
This week:0
All time:8,340
This week:571Up