Download the PHP package crudly/encrypted without Composer
On this page you can find all versions of the php package crudly/encrypted. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download crudly/encrypted
More information about crudly/encrypted
Files in crudly/encrypted
Package encrypted
Short Description Encryption and hashing casts for Eloquent
License MIT
Homepage https://github.com/crudly/encrypted
Informations about the package encrypted
Encrypted
Note This package is no longer needed for new projects as hashing is now among the native casts and encryption was there for a while already. We will probably keep it up to date for a few more years because it usually only takes bumping a version tag.
A custom cast class for Laravel Eloquent that encrypts or hashes your values. Package is small and provides just a few, simple, well tested features.
Installation
Use composer.
Usage
Mark any column in your model as encrypted.
You can work with the attribute as you normally would, but it will be encrypted on the database.
Type casting
Encryption serializes the variable and decryption unserializes it, so you get out exactly what you put in. This usually means that no type casting is needed.
But sometimes you want everything casted to some type even if you put something else in. In those cases you can specify types (all of Eloquent's default casts are supported):
Password hashing
This can also be used to hash a password upon write.
This hashes the password using bcrypt
. You can check a string against the hashed password using Hash
facade.
TODO
Maybe add key and cipher customization via options, i.e. Encrypted::class.':string,AckfSECXIvnK5r28GVIWUAxmbBSjTsmF'
and Encrypted::class.':string,AckfSECXIvnK5r28GVIWUAxmbBSjTsmF,AES-128-CBC'
. And password hashing options.