Releases: contentful/contentful.php
Releases · contentful/contentful.php
3.2.0
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
Added
- Entries now have a
has($field)method (with a magichasX()equivalent) which returns whether an entry has the given field currently loaded.
Changed
- The magic
__callmethod now allow for access also using the actual field name, withoutgetprefix (for instance$entry->title()). This was done to further improve compatibility on edge cases with templating engines such as Twig.
3.0.2
3.0.1
3.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.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
ResourceBuildernow supports custom data type matchers so users can create their own custom resource classes. - All resource classes now extend
Contentful\Delivery\Resource\BaseResource, which implementsContentful\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 theArrayAccessinterface ($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 levelE_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, andLocale,DeletedAsset, 'DeletedEntry', andDeletedContentTypeclasses 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\Deliverynamespace 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
baseUriinstead ofuriOverride, 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 ofContentful\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 calledClient::parseJson()to better reflect its meaning.- The Sync API currently only works with the
masterenvironment. When trying to perform sync-related operations on a client which is configured with any other environment, a\RuntimeExceptionwill 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\EntryInterfaceno longer exists. UseContentful\Delivery\Resource\Entryfor type hinting. [BREAKING]Contentful\JsonHelperwas deprecated in 2.2, and has now been removed. [BREAKING]Contentful\DateHelperwas deprecated in 2.2, and has now been removed. [BREAKING]Contentful\File\UploadFilewas deprecated in 2.1, and has now been removed. UseContentful\Core\File\RemoteUploadFileinstead. [BREAKING]- Resource classes have now a protected constructor, because they are not supposed to be instantiated without using the
ResourceBuilder. [BREAKING] Asset,ContentType,Entry, andDeletedResourceclasses 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 aSystemPropertiesobject. See the upgrade guide for more. [BREAKING]
3.0.0-beta1
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
Added
- The
Contentful\Synchronization\Managerclass now provides a convenience method calledsync($token = null, Query $query = null)which transparently handles a full sync, instead of having to manually callstartSyncandcontinueSync. The method returns instances ofContentful\Synchronization\Resultwrapped in a\Generatorobject. - Added missing exception class
Contentful\Exception\BadRequestException.
2.4.0
Added
- The
Contentful\Delivery\Queryclass now haslinksToEntry('<entry_id>')andlinksToAsset('<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>').DynamicEntryalso 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:riskyruleset 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
@apior@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
2.2.0
Changed
DateHelper::formatForJson()is now deprecated and will be removed in version 3. UseContentful\format_date_for_json()instead.JsonHelper::encode()andJsonHelper::decode()are now deprecated and will be removed in version 3. UseGuzzleHttp\json_encode()andGuzzleHttp\json_decode()instead.
Fixed
LogEntrynow modifies the exception stack trace (if present) to prevent problems during serialization.