Releases: PhpGt/Cookie
Cookie::__toString
A simple release, but one that includes a missing feature: the ability to pass Cookie objects into functions that typehint string parameters.
Also:
- Faster unit test execution
- No development dependencies (cleaner tree, faster install)
Array conversion and clearing of cookies
Some areas of code are not always under your control, and if an area of code expects to see the cookies in an associative array call the asArray
method.
More importantly, it's now possible to clear all or specific cookies by using the clear()
function, passing in any cookie names that you want to remove.
v1 release
The repository has been in use for many months now, but has not made a v1 release until now because of a tricky bug that only occurred every so often in the unit tests.
The bug was caused by using in_array
without the strict type flag. This was only a bug in the unit tests, so no new functionality has been added or changed to mark the stable release.
Fully tested
The final backwards-breaking change is that the path of a cookie is now always hard-coded to "/" - as setting a cookie per-directory is not recommended behaviour and can lead to confusing side effects.
There are a few integration tests to be made on this simple repository before it is released as v1.0.0, but until then there will be no backwards-breaking changes introduced.
Documentation update
v0.1.1 Update CONTRIBUTING.md
CookieHandler complete
The CookieHandler
class is what is used to interface with cookies, and behaves just like the $_COOKIE
superglobal so it is easy to get used to.
- ArrayAccess to get quick access to cookie values.
- get, set, has, delete methods for OOP usage.
Cookie object implemented
The Cookie object is a very simple object that acts as a representation of a key value pair, but with the immutable object pattern to avoid other classes editing their value on-the-fly.
"The practice by which changes result in a new instance is termed immutability, and is a feature designed to ensure the integrity of a given value".
This is important with Cookies, because once they are set on the Request/Response, they object representation shouldn't be changed without being set again.