Download the PHP package friendsofhyperf/encryption without Composer

On this page you can find all versions of the php package friendsofhyperf/encryption. 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 encryption

Encryption

中文说明

The encryption component provides authenticated encryption for values and strings in Hyperf.

Installation

The package targets Hyperf 3.2. Install the optional opis/closure package only when encrypted closures need to be signed:

Configuration

Publish the configuration file:

This creates config/autoload/encryption.php with these settings:

Configuration key Environment variable Default
encryption.key APP_KEY A bundled example base64: key
encryption.cipher APP_CIPHER AES-256-CBC

Replace the bundled example key before using the component. A base64: prefix tells the component to Base64-decode the remaining value before validating its length. Generate a new key for the default cipher with:

Supported ciphers and raw key lengths are:

Cipher Key length
AES-128-CBC 16 bytes
AES-256-CBC 32 bytes
AES-128-GCM 16 bytes
AES-256-GCM 32 bytes

Cipher names are case-insensitive. A missing key throws FriendsOfHyperf\Encryption\Exception\MissingKeyException; an unsupported cipher or incorrect key length throws RuntimeException.

Helper Functions

The package autoloads namespaced encrypt() and decrypt() functions. Import them before use:

encrypt(mixed $value, bool $serialize = true) serializes values by default, and decrypt(string $payload, bool $unserialize = true) reverses that behavior. Pass false to both second arguments when handling a raw string without serialization.

Encrypter API

The container binds FriendsOfHyperf\Encryption\Encrypter, FriendsOfHyperf\Encryption\Contract\Encrypter, and FriendsOfHyperf\Encryption\Contract\StringEncrypter to the configured encrypter.

The concrete Encrypter also exposes encrypt(), decrypt(), getKey(), getAllKeys(), getPreviousKeys(), previousKeys(), and the static supported() and generateKey() methods.

Key Rotation

Configure previous raw keys on the concrete encrypter to decrypt existing payloads after rotating the current key. New payloads always use the current key.

Every previous key must have the correct length for the current cipher.

Failures and Optional Closure Signing

Encryption failures throw FriendsOfHyperf\Encryption\Contract\EncryptException. Invalid, tampered, or undecryptable payloads throw FriendsOfHyperf\Encryption\Contract\DecryptException.

When opis/closure is installed and encryption.key is configured, the boot listener registers the same parsed key with Opis\Closure\SerializableClosure for closure signing. The component does not require opis/closure for normal value or string encryption.


All versions of encryption with dependencies

PHP Build Version
Package Version
Requires hyperf/context Version ~3.2.0
hyperf/contract Version ~3.2.0
hyperf/di Version ~3.2.0
hyperf/event Version ~3.2.0
hyperf/stringable Version ~3.2.0
hyperf/tappable Version ~3.2.0
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 friendsofhyperf/encryption contains the following files

Loading the files please wait ...