PHP 7.2 came out on the last day of November. Mcrypt is out of core, libsodium is in. That trade alone makes it a good release.

Search any forum for “php encrypt” and you find the same folk recipe: openssl_encrypt with AES-256-CBC, an IV made from who knows what, no authentication of the ciphertext. Every choice in that recipe is a place to be wrong, and CBC without a MAC is wrong in a way that has published attacks. The developer is not careless. The API hands an application developer decisions that belong to a cryptographer.

Sodium takes the decisions away. One task, one function, the right parameters inside:

$key = sodium_crypto_secretbox_keygen();
$nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
$cipher = sodium_crypto_secretbox($message, $nonce, $key);

No cipher to pick, no mode to pick, authentication built in. Tampered ciphertext fails to open instead of decrypting into garbage that your code then trusts.

Three tasks, three tools, and mixing them is the classic mistake. Passwords go through password_hash, and 7.2 adds Argon2i there. It is one-way on purpose, you never need the password back. Data you must read again is secretbox, or crypto_box when two parties are involved. Proving authorship without hiding anything is sodium_crypto_sign. If you are encrypting passwords or hashing things you need back, stop and re-read the task.

What sodium does not solve is keys. A key in the repo protects nothing. Keep it in the environment or a secrets store, apart from the data it protects, and decide on rotation before the incident.

Above all: use primitives made by people who break them for a living. The moment you design your own scheme out of hash functions and XOR, you have already lost. You just have not been told yet.