Skip to content

Releases: contentful/contentful.php

4.1.0

28 Nov 09:17
Compare
Choose a tag to compare

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, and Contentful\Delivery\ResourcePool\Extended, which also keeps a reference to entries and assets. The latter class was known as Contentful\Delivery\ResourcePool, which has now been deprecated and will be removed in version 5.0. The Extended class is the default one, as it is designed to work with regular PHP requests. In order to use the Standard pool, you must enable it through the ClienOptions class:
    $options = ClientOptions::create()
        ->withLowMemoryResourcePool();
    $client = new Client($token, $spaceId, $environmentId, $options);
    As this resource pool provides no caching (and include values 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

09 Nov 13:41
Compare
Choose a tag to compare

Fixed

  • Resolving links from an entry using non-default locale caused the SDK to wrongly assume the locale=*. Now this is fixed, and the entry will use either its current locale, if set, or the the locale=* if no locales are currently configured.

4.0.1

08 Nov 15:07
Compare
Choose a tag to compare

Fixed

  • Second parameter in LinkResolver::resolveLinkCollection() was changed from string $locale = null to array $parameters = [].

4.0.0

08 Nov 11:06
Compare
Choose a tag to compare

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 Client constructor 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 the ClientOptions object. See the upgrade guide for a more detailed explanation. [BREAKING]
  • The Client object now implements Contentful\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/core package. 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 operators near or lte). As many users did not know this and appended the operator to the first parameter of where(), now the third parameter was removed. [BREAKING]
  • The way system properties are handled was completely changed: previously the SDK used a general SystemProperties class with many nullable properties, now every resource type has its own system properties implementation. For instance, the calling Contentful\Delivery\Resource\Entry::getSystemProperties() will now return an instance of Contentful\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 to false.
  • Logic for resolving links was moved from the Client to a LinkResolver object. The client still provides a convenience resolveLink() method which forwards the call.
  • Method Client::isPreview() was renamed Client::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 CacheItemPoolFactoryInterface now enforces the return type. [BREAKING]
  • Class InstanceRepository was renamed ResourcePool, and method Client::getInstanceRepository() was renamed Client::getResourcePool(). [BREAKING]
  • Method ResourcePool::generateKey() contained the $api parameter, 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 $preview to $isDeliveryApi, which is the opposite value. However, users should never build the manager themselves, as they should access it through Client::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 regular InvalidArgumentException is thrown. [BREAKING]

3.4.0

24 Aug 10:59
Compare
Choose a tag to compare

Added

  • The SDK can now use a locally-cached copy of entries and asset. While this will not prevent API calls when using getEntries or getAssets, it will intercept calls made with getEntry and getAsset, including those being made when resolving a link from an entry. You can enable this either using the CLI commands with the --cache-content flag, or passing 'cacheContent' => true to the $options array 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

18 Jun 08:40
Compare
Choose a tag to compare

Added

  • Added getSpaceId and getEnvironmentId to the Client.

3.2.3

15 Jun 14:25
Compare
Choose a tag to compare

Fixed

  • Fixed incremental build of entries with non-default locale.

3.2.2

06 Jun 12:23
Compare
Choose a tag to compare

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.

3.2.1

01 Jun 10:03
Compare
Choose a tag to compare

Maintenance release.

3.2.0

27 Apr 10:43
Compare
Choose a tag to compare

Added

  • Sync API now also works on non-master environments.

Fixed

  • Cache keys for entries and assets sometimes did not contain the locale part, leading to possibly duplicate requests. Now info about locales is prefetched, making sure that cache keys are always correct.