Download the PHP package nickcv/yii2-encrypter without Composer

On this page you can find all versions of the php package nickcv/yii2-encrypter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii2-encrypter

Openssl Encrypter for Yii2

Openssl Encrypter for Yii2 Version 1.1.0

This extension is used for two-way encryption. The cypher method used is AES, and you can either use the 128 bites or 256 bites encryption.

You can also decide whether you want to use base64 encoding on the encrypted string to make it easier to store it, keeping in mind that the additional encoding will always increase the size of the string.

Openssl has been used in place of mcrypt because of its sheer speed in the encryption and decryption process (up to 30 times faster).

Installation

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json file.

Set Up

Once the extension is installed you can either add manually the configuration in the file or you can use the command line installer that will randomly generate your encryption password and IV.

Manual Installation


Add the following lines in the section of your file.

I recommend using base64 encoding to make it easier to store the encrypted string.

The IV must always be 16 bites long, keep that in mind in case you use multibyte characters.


Automatic Installation


Modify your config file, adding the encrypter to the list of bootstrapped modules

Add then the module to the module list

At this point you will be able to simply execute from the root of your app directory the command

The command will automatically generate the config file in your application directory. The generated config file will contain a randomly generated password and IV.

You will now only have to add the extension to your config file


Basic Usage

You can now use the encrypter manually in any part of the application to either encrypt a string

or decrypt and encrypted string

Behavior

The extension also comes with a behavior that you can easily attach to any ActiveRecord Model.

Use the following syntax to attach the behavior.

The behavior will automatically encrypt all the data before saving it on the database and decrypt it after the retrieve.

Keep in mind that the behavior will use the current configuration of the extension for the encryption.

Console Commands

If the console module is installed you can also use the and console commands.

To find out how to install the console module follow the "Automatic Installation" instructions in this document.

Unit Testing

The entire extension was built with TDD. To launch the tests just go inside the extension directory and execute the command.

Warnings

It is extremely hard to decrypt the data without the password and IV, keep a copy of them to avoid losing all your data.

Two-way encryption should not be used to store passwords: you should use a one-way encryption function like sha1 and a SALT


All versions of yii2-encrypter with dependencies

PHP Build Version
Package Version
Requires yiisoft/yii2 Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nickcv/yii2-encrypter contains the following files

Loading the files please wait ....