All notable changes to this project will be documented in this file, in reverse chronological order by release.
- Nothing
- Nothing.
- Nothing.
- Nothing
- #19 Fixes a change in the payload receive from the API - previously, number fragments were always floats. Now they might be integers.
- Nothing.
- Nothing.
- Nothing
- Nothing.
- Nothing.
- Nothing.
- #6 removes the
\Prismic\Api::reloadApiData()
method - whilst this is a BC break. It was only introduced in4.1.0
a couple of weeks ago so it's unlikely that anyone is even aware it was there in the first place.
- #6 removes the need to
reloadApiData
after a cache bust by simply not keeping a reference to the Api Data payload in memory.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #5 ensures that the preview token is validated before any attempt is made to retrieve a ref from the api.
- #4 Adds a new Exception
ExpiredPreviewTokenException
that is thrown duringApi::previewSession()
- #4 Changes behaviour of
Api::previewSession()
by throwing anExpiredPreviewTokenException
in situations where a preview token has expired.
- Nothing.
- Nothing.
- Nothing.
- Nothing
- Added method
void \Prismic\Api::reloadApiData()
to forcefully re-fetch the api data from the remote service. You would not normally need to call this in a standard web server environment because simply flushing the cache would be sufficient. However, in a cli environment handling multiple requests, flushing the cache will not free the\Prismic\ApiData
instance in memory, so you'd need to call this method during perhaps a web-hook triggered cache busting event…
- Nothing
- Nothing
- Existing query strings are now preserved when setting the API Url. This is important if you are using integration fields
- Potential error fixed in
Api::previewSession()
where the link resolver could potentially be null
Api::forms()
now returns a new classSearchFormCollection
rather than a simple stdClass from json_decode. This improves type safety.Api::setRequestCookies(array) : void
allowing you to provide the request cookies to the Api instance manually for those situations where the $_COOKIE super global doesn't exist.
Api::VERSION
is deprecated - it's not used anywhere and is pointless
- Fixed preservation of line breaks when rich text does not contain spans
- Altered serialisation of HTML for structured text elements so that it preserves line breaks, replacing them with <br />
Initial release highlights include:
- \Psr\Cache is now used for caching
- Min version of PHP is now >= 7.1
- strict_types throughout with scalar type hints and return types
- Much improved test coverage ~ 95%
- Introduced document hydration so you can implement concrete content models in code
- Re-Introduced typed content fragments such as
RichText
,Date
,Embed
,GeoPoint
etc. - Transparent support for both V1 and V2 Apis
- Default document implementation can retrieve it's own relationships such as alternative translations
- Guaranteed to throw predictable exceptions all implementing the same interface in the same namespace
The LinkResolver
as a concept is now pretty much a hard dependency for \Prismic\Api
but relies on setter injection. The good thing is that this enables other elements, such as RichText
to be serialised to HTML without needing to keep a link resolver handy all the time, i.e. $textFragment->asHtml()
instead of $textFragment->asHtml($linkResolver)
which can be annoying in views, but the bad thing is that it's a hidden dependency. At some point this needs to be made more friendly…
The same could be said of the Hydrator
- The defaults are perfectly acceptable and they are straight-forward to override but it's still a hidden dependency.
In future, I'm considering providing ready to use factories and configuration suitable for Psr\Container
- it's good to practice dependency injection and everyone's doing it right?
- Methods
getByID
,getByIDs
,getByUID
have been camel-cased togetById
,getByIds
andgetByUid
- Method
previewSession
signature has changed. A Link resolver is no longer required:previewSession( string $token, string $defaultUrl) : string
- Named constructor
get()
has changed to `Api::get( string $action, string $accessToken, Client $httpClient, \Psr\Cache\CacheItemPoolInterface $cache)