Releases: contentful/contentful.php
Releases · contentful/contentful.php
4.1.1
4.1.0
Added
- When working with huge datasets (tens of thousands of resources), for instance with custom CLI commands, the default resource pool may have caused the application to use too much memory and crash. Now there are two different resource pools:
Contentful\Delivery\ResourcePool\Standard, which is a lightweight implemention and only caches space, environment and content types, andContentful\Delivery\ResourcePool\Extended, which also keeps a reference to entries and assets. The latter class was known asContentful\Delivery\ResourcePool, which has now been deprecated and will be removed in version 5.0. TheExtendedclass is the default one, as it is designed to work with regular PHP requests. In order to use theStandardpool, you must enable it through theClienOptionsclass:As this resource pool provides no caching (and$options = ClientOptions::create() ->withLowMemoryResourcePool(); $client = new Client($token, $spaceId, $environmentId, $options);
includevalues are now skipped, for this reason), it might cause the SDK to make more API calls, so its used is discouraged for regular web applications.
4.0.2
4.0.1
4.0.0
ATTENTION: This release contains breaking changes. Please take extra care when updating to this version. See the upgrade guide for more.
PHP Version
- Support for PHP 5.6 was dropped. The library now requires PHP 7.0 or higher, and all files use strict types, with scalar type declarations present whenever possible. As PHP 7.0 is also about to reach end of life, we strongly suggest you upgrade to at least PHP 7.1. However, this major release line of the SDK (version 4) will support PHP 7.0 regardless of its status.
Added
- The
Clientconstructor signature was changed:public function __construct(string $accessToken, string $spaceId, string $environmentId = 'master', \Contentful\Delivery\ClientOptions $options = null). All options that were previously handled through the remaining parameters or the options array can now be set using theClientOptionsobject. See the upgrade guide for a more detailed explanation. [BREAKING] - The
Clientobject now implementsContentful\Delivery\Client\ClientInterface. We encourage users to type hint against this interface rather than against the concrete implementation. - The SDK now offers support for rich text. Check the tutorial on the Contentful website for more.
Changed
- The SDK now uses version 2 of the
contentful/corepackage. We encouraged users to check its changelog and upgrade guide. - The
Query::where()method used to accept a third parameter, which was used to specify the type of search (for instance with operatorsnearorlte). As many users did not know this and appended the operator to the first parameter ofwhere(), now the third parameter was removed. [BREAKING] - The way system properties are handled was completely changed: previously the SDK used a general
SystemPropertiesclass with many nullable properties, now every resource type has its own system properties implementation. For instance, the callingContentful\Delivery\Resource\Entry::getSystemProperties()will now return an instance ofContentful\Delivery\SystemProperties\Entry, which contains only the necessary methods. [BREAKING] - Method
Entry::has()when checking against a link by default checks if the link can also be resolved. This behavior can be turned off by setting the third parameter tofalse. - Logic for resolving links was moved from the
Clientto aLinkResolverobject. The client still provides a convenienceresolveLink()method which forwards the call. - Method
Client::isPreview()was renamedClient::isPreviewApi(). Its opposite,Client::isDeliveryApi(), was also added. [BREAKING] - Method
Contentful\Delivery\Mapper\BaseMapper::hydrate()was removed. If using a custom mapper, you can use$this->hydrator->hydrate(object|string $target, array $data). [BREAKING] - Interface
CacheItemPoolFactoryInterfacenow enforces the return type. [BREAKING] - Class
InstanceRepositorywas renamedResourcePool, and methodClient::getInstanceRepository()was renamedClient::getResourcePool(). [BREAKING] - Method
ResourcePool::generateKey()contained the$apiparameter, which was removed as a resource pool object is supposed to operate within a single API context. [BREAKING] - Third parameter of synchronization manager constructor was changed from
$previewto$isDeliveryApi, which is the opposite value. However, users should never build the manager themselves, as they should access it throughClient::getSyncronizationManager(). [BREAKING]
Fixed
- Using magic method
Entry::getSomething()with an invalid field previously resulte in an error being triggered. This behavior was fixed and now a regularInvalidArgumentExceptionis thrown. [BREAKING]
3.4.0
Added
- The SDK can now use a locally-cached copy of entries and asset. While this will not prevent API calls when using
getEntriesorgetAssets, it will intercept calls made withgetEntryandgetAsset, including those being made when resolving a link from an entry. You can enable this either using the CLI commands with the--cache-contentflag, or passing'cacheContent' => trueto the$optionsarray in the client constructor (requires'autoWarmup'to also be set to true).
Fixed
- Made sure that cache keys are always PSR-6 compliant. Certain PSR-6 implementations have more lax requirements and the SDK took advantage of that, but now all keys only use the character set defined in the official specification.
3.3.0
3.2.3
3.2.2
Fixed
- The SDK internally keeps a registry of built resources, and for this reason, partially selecting fields in an entry might have resulted in successive API calls returning the first "incomplete" version. Now entries are continuously updated, so multiple successive API calls will update a resource to include all recently-fetched fields, plus the already existing ones.
- The SDK previously used the hyphen symbol (
-) as a separator in cache keys. However, some more restrictive PSR-6 implementations do not allow that, so it's been changed to a dot (.) instead.