How to write Mysql Update database query using Magento 2?

Run Update SQL query in a given database table by Magento 2 in a standard way without the use of Object Manager.

You can write an update MySQL query in the ResouceModel PHP class.

When you write any custom update query, You need to create a function in the ResourceModel folder PHP file.
Continue reading “How to write Mysql Update database query using Magento 2?”

Url Encode and Decode using Magento 2.

You can encode and decode the URL using Magento 2 with native functionality.

Using Url Encode, they encode the base64_encode() for URLs encoding using encode() function.

Using Url Decode, they decode the base64_decode() for URLs decoding. Continue reading “Url Encode and Decode using Magento 2.”

How to encrypt and decrypt string in Magento 2?

You can Encrypt or Decrypt any string using Magento 2 with native interface functionality.

You can encrypt or decrypt password or credit card data or any value you need to encrypt using Magento\Framework\Encryption\EncryptorInterface interface.

Example, You can encrypt the password with below way, Continue reading “How to encrypt and decrypt string in Magento 2?”