ALPHA Framework: Storage 1.2 … What’s new?
ALPHA Framework‘s Storage Class allows you to store any data in cookie or session in a way as simple as secure.
The changelog of the Storage Class tells:
/* * ChangeLog: * * V 1.1 * - Added VERSION constant. * - Improved the write() and read() methods. * - Improved encryption methods: now they check for the existence of the used methods. * - Optional encryption of the stored data via the definable application constant STORAGE_SECURE_DATA. * - Add public method setSalt() * - (Almost) full documented * - Removed SessionStorage and CookieStorage classes from this file. * - defined methods scope * * V 1.2 * - Added public method enableEncryption() * - Created Unit Test for CookieStorage * ( reachable using this querystring ?core_info=unit-test&class=cookieStorage ) * - Enforced the decrypt method: now the metod tries to detect if the stored data is encrypted before decrypting it */
Until Version 1.0, I’ve supposed that
mcrypt_decrypt() methods always exists in the xAMP installation, but I was wrong and the goal of the new version is to allow the users to install and use ALPHA Framework, in the same way (or at least similar), both on their own Dedicated Server or his limited resources hosting. So more checks were added to the Class to prevent warnings and fatal error.
New method setSalt() was added to change the saltKey used for the encrytpion.
In the Version 1.2 a new public method enableEncryption() was created so the user can choose which element to write as encrypted/plain data in the defined data storage. This choice was available since the first release of the Storage Class, but it could be enabled by defining constant and not editable at runtime. With this new method the encryption/decryption can be changed at run-time.
As made for the Model Class, the Storage Class got its unit test page too and it’s reachable using one of the following querystrings:
- For the CookieStorage class use:
- For the SessionStorage class use:
To uniform the Storage Class to the other ones of ALPHA Framework, I’ve just removed from the file Storage.php file the CookieStorage and SessionStorage Classes and put each one in a new file in the /classes/Storages/ directory.
Again both the SessionStorage and CookieStorage Classes implements the iStorage interface.
In the end
As told in the previous post, all changes made to ALPHA Framework are focused to the simplification of making Web Applications! So you can understand that Coding Never Been So Smart!
Note: If you’re fascinated or just curious about this framework you can follow updates following ALPHA Framework on Twitter and watch the official repository or just tell us you like ALPHA Framework on Facebook!