Skip to content

3.0.0

Choose a tag to compare

@dborsatto dborsatto released this 16 Apr 14:44
· 272 commits to master since this release

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.5 was dropped. PHP 5.5 has reached EOL in July 2016, so we highly discourage anyone from keep using it for multiple reasons, including possible security concerns. The SDK now requires at least PHP 5.6; however, PHP 5.6 is not actively supported and currently only security fixes are provided. Because of this, we strongly encourage everybody to upgrade to a version in the PHP 7 branch, ideally 7.1 or 7.2, which are actively supported. Many other popular frameworks and tools already require a version in the PHP 7 branch: Symfony 4 requires 7.1, Laravel 5.5 requires 7.0, Laravel 5.6 requires 7.1, PHPUnit 6 requires 7.0, PHPUnit 7 requires 7.1, etc. Because of the clear convergence of the PHP ecosystem towards this upgrade, and the availability of tools that allow you to easily manage your PHP version (such as Docker), we can't guarantee that the next major version of this SDK (version 4) will still keep compatibility with PHP 5.6. However, compatibility is guaranteed for the whole lifecycle of the PHP Contentful Delivery SDK version 3, and important bugfixes (including security-related ones) will be backported once version 4 will be released.

Added

  • The SDK now supports space environments.
  • The ResourceBuilder now supports custom data type matchers so users can create their own custom resource classes.
  • All resource classes now extend Contentful\Delivery\Resource\BaseResource, which implements Contentful\Core\Resource\ResourceInterface. You can use these two classes for type hinting.
  • Entry objects now support accessing fields through virtual properties with __get ($entry->title) and using the ArrayAccess interface ($field['title']).

Fixed

  • There was an issue when adding a new field to a Contentful content type without purging the SDK cache, with the SDK not knowing how to build the field. Now it will create a temporary fake field of type Unknown, and it will also trigger a silenced error of level E_USER_WARNING (so users can implement some custom logic for handling the issue, without causing any problems to the actual execution). When retrieving the unknown field, it will be returned as it was fetched from the API, so no conversion will be made. This means that dates will be returned as strings, links will be returned as simple arrays, etc. This solution was implemented to prevent the SDK from crashing during those (hopefully) brief moments where the cache is out of sync with Contentful, and it should not be relied upon for actually handling the fields in a proper way.

Changed

  • The cache system has been rewritten to be made PSR-6 compatible (thanks Magnus Nordlander (@magnusnordlander)). [BREAKING]
  • DynamicEntry, Asset, ContentType, ContentTypeField, Space, and Locale, DeletedAsset, 'DeletedEntry', and DeletedContentType classes have been moved to a different namespace. Please check the the upgrade guide for more details. [BREAKING]
  • All parts of the SDK that were not in the Contentful\Delivery namespace have been moved to a separate package called contentful-core.php.
  • The option in the client constructor for specifying a custom URI is now called baseUri instead of uriOverride, to be more consistent with the one used in Guzzle. [BREAKING]
  • The SDK no longer used a custom logger. It now supports any PSR-3 compatible logging implementation for permanent storage, but easy access to a log of current API requests is provides through Client::getMessages(), which returns an array of Contentful\Core\Api\Message. [BREAKING]
  • The SDK now keeps a registry of all resources that are currently managed, called Contentful\Delivery\InstanceRepository. This class also wraps the PSR-6 cache pool.
  • Client::reviveJson() is now called Client::parseJson() to better reflect its meaning.
  • The Sync API currently only works with the master environment. When trying to perform sync-related operations on a client which is configured with any other environment, a \RuntimeException will be thrown.
  • Previously, entry objects would try to use the locale fallback chain even in situations where this might lead to results that differ from those that would be normally returned from the Delivery (or Preview) API. For this reason, when requesting an entry using any other locale than locale=*, the locale fallback chain will not be used. The Sync API defaults to using all locales, so it's not affected. [BREAKING]

Removed

  • Contentful\Delivery\EntryInterface no longer exists. Use Contentful\Delivery\Resource\Entry for type hinting. [BREAKING]
  • Contentful\JsonHelper was deprecated in 2.2, and has now been removed. [BREAKING]
  • Contentful\DateHelper was deprecated in 2.2, and has now been removed. [BREAKING]
  • Contentful\File\UploadFile was deprecated in 2.1, and has now been removed. Use Contentful\Core\File\RemoteUploadFile instead. [BREAKING]
  • Resource classes have now a protected constructor, because they are not supposed to be instantiated without using the ResourceBuilder. [BREAKING]
  • Asset, ContentType, Entry, and DeletedResource classes previously provided shortcut methods for accessing system properties such as revision, createdAt, etc. These shortcut methods have been removed from the main resource, but they're still accessible through a SystemProperties object. See the upgrade guide for more. [BREAKING]