Skip to content

Releases: contentful/contentful.php

3.2.0

27 Apr 10:43

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.

3.1.0

26 Apr 11:52

Choose a tag to compare

Added

  • Entries now have a has($field) method (with a magic hasX() equivalent) which returns whether an entry has the given field currently loaded.

Changed

  • The magic __call method now allow for access also using the actual field name, without get prefix (for instance $entry->title()). This was done to further improve compatibility on edge cases with templating engines such as Twig.

3.0.2

19 Apr 17:04

Choose a tag to compare

Fixed

  • Cache keys now include space ID and environment ID to better handle possible edge cases.

3.0.1

17 Apr 11:01

Choose a tag to compare

Fixed

  • Updated the SDK to use a stable version of contentful-core.

3.0.0

16 Apr 14:44

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.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 @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]

3.0.0-beta1

07 Mar 14:16
7404da5

Choose a tag to compare

3.0.0-beta1 Pre-release
Pre-release

ATTENTION

This is a new major version of the SDK, and contains breaking changes from version 2.

Please read carefully the CHANGELOG and the upgrade guide.

2.4.1

25 Jan 10:34

Choose a tag to compare

Added

  • The Contentful\Synchronization\Manager class now provides a convenience method called sync($token = null, Query $query = null) which transparently handles a full sync, instead of having to manually call startSync and continueSync. The method returns instances of Contentful\Synchronization\Result wrapped in a \Generator object.
  • Added missing exception class Contentful\Exception\BadRequestException.

2.4.0

11 Jan 10:40

Choose a tag to compare

Added

  • The Contentful\Delivery\Query class now has linksToEntry('<entry_id>') and linksToAsset('<entry_id>') methods. For users on older versions of the SDK, the same operators can be emulated by using $query->where('links_to_entry', '<entry_id>') and $query->where('links_to_asset', '<asset_id>'). DynamicEntry also provides a shortcut in the form $entry->getReferences().

Changed

  • The SDK now implements a strict coding standard based on the one found on the Symfony Demo. The @Symfony:risky ruleset is currently implemented, but this could be subject to change in the event of possible incompatibilities. The style check is a mandatory part of CI.
  • Methods are no longer marked as @api or @internal. If a method is public, it's assumed to be part of the API surface of the SDK, and thus any breaking change to that would require a new major version.

2.3.0

01 Dec 09:33

Choose a tag to compare

Changed

  • Dependencies to symfony/console and symfony/filesystem now also allow version ~4.0.

2.2.0

26 Sep 15:19

Choose a tag to compare

Changed

  • DateHelper::formatForJson() is now deprecated and will be removed in version 3. Use Contentful\format_date_for_json() instead.
  • JsonHelper::encode() and JsonHelper::decode() are now deprecated and will be removed in version 3. Use GuzzleHttp\json_encode() and GuzzleHttp\json_decode() instead.

Fixed

  • LogEntry now modifies the exception stack trace (if present) to prevent problems during serialization.