Download the PHP package contentful/contentful without Composer

On this page you can find all versions of the php package contentful/contentful. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package contentful

Join Contentful Community Slack   Join Contentful Community Forum

contentful.php — Contentful PHP Delivery Library

Packagist PHP version Packagist CircleCI

PHP library for the Contentful Content Delivery API and Content Preview API. It helps you to easily access your Content stored in Contentful with your PHP applications.

What is Contentful?

Contentful provides content infrastructure for digital teams to power websites, apps, and devices. Unlike a CMS, Contentful was built to integrate with the modern software stack. It offers a central hub for structured content, powerful management and delivery APIs, and a customizable web app that enable developers and content creators to ship their products faster.

Table of contents - [contentful.php — Contentful PHP Delivery library](#contentfulphp-contentful-php-delivery-library) - [What is Contentful?](#what-is-contentful) - [Core Features](#core-features) - [Getting started](#getting-started) - [Installation](#installation) - [Your first request](#your-first-request) - [Using this library with the Preview API](#using-this-library-with-the-preview-api) - [Authentication](#authentication) - [Documentation & References](#documentation-references) - [Configuration](#configuration) - [Reference documentation](#reference-documentation) - [Tutorials & other resources](#tutorials-other-resources) - [Upgrade](#upgrade) - [Reach out to us](#reach-out-to-us) - [You have questions about how to use this library?](#you-have-questions-about-how-to-use-this-library) - [You found a bug or want to propose a feature?](#you-found-a-bug-or-want-to-propose-a-feature) - [You need to share confidential information or have other questions?](#you-need-to-share-confidential-information-or-have-other-questions) - [Get involved](#get-involved) - [License](#license) - [Code of Conduct](#code-of-conduct)

Core Features

Getting started

In order to get started with the Contentful PHP library you'll need not only to install it, but also to get credentials which will allow you to have access to your content in Contentful. This package requires PHP 7.2 or higher or PHP 8.0 or higher.

Installation

Install the library using Composer:

Your first request

The following code snippet is the most basic one you can use to get some content from Contentful with this library: All interactions with the library go through Contentful\Delivery\Client. To create a new client an access token and a space ID have to be passed to the constructor.

Using this library with the Preview API

This library can also be used with the Preview API. In order to do so, you need to use the Preview API access token, available on the same page where you get the Delivery API token, and tell the client to use the different API:

You can find all available methods of our client in our reference documentation.

Authentication

To get your own content from Contentful, an app should authenticate with an OAuth bearer token.

You can create API keys using the Contentful web interface. Go to the app, open the space that you want to access (top left corner lists all the spaces), and navigate to the APIs area. Open the API Keys section and create your first token. Done.

Don't forget to also get your Space ID.

For more information, check the Contentful REST API reference on Authentication.

Documentation & References

Configuration

The ClientOptions class allows you to configure the client in a variety of different ways:

Client parameter Default Description
$accessToken Required. Your access token
$spaceId Required. Your space ID
$environmentId 'master' Your environment ID
$options null A ClientOptions object
ClientOptions method Parameters Description
usingPreviewApi() - Use the Preview API host (preview.contentful.com)
withDefaultLocale() string $locale Set a locale to be automatically used for all requests
withHost() string $host A string to override the default Contentful API URL, useful if you have a proxy between your application and the Contentful API
withLogger() Psr\Log\LoggerInterface $logger A PSR-3 logger. Two types of logs are written: a generic one using either the INFO or ERROR level (depending on the response status code) with a brief summary, and a complete dump of request and response using the DEBUG level. We suggest to configure the logger minimum level according to your needs.
withCache() Psr\Cache\CacheItemPoolInterface $cache A PSR-6 cache item pool. This will be used to stored data such as content types and locales, which are always needed but don't change often
withCache() bool $autoWarmup = false When using a cache pool, set this to true to automatically fill the cache during regular use
withCache() bool $cacheContent = false When using a cache pool with $autoWarmup set to true, se this to true to fill the cache with entries and assets during runtime. This may speed up execution when calling $client->getEntry($entryId) and $client->getAsset($assetId), but not when calling the getEntries() and getAssets() methods, as the client can't reliably know which entries or assets will be returned by the API, and for this reason the cache can't intercept the call.
withHttpClient() GuzzleHttp\Client $client A Guzzle client instance, which can be configured with custom middleware
withoutMessageLogging() - Do not store API requests and responses (which can use a lot of memory). If messages are not stored, they will not be retrievable from Client::getMessages() for debugging and inspection purposes
withQueryCache() Psr\Cache\CacheItemPoolInterface $queryCacheItemPool A PSR-6 cache item pool. This will be used to cache items retrieved with queries when calling $client->getEntries($query).
withQueryCache() int $queryCacheLifetime = 0 The number of seconds of lifetime for $client->getEntries($query) cache items. There's no invalidation mechanism on these cache items so consider to set a low lifetime (for example 60 seconds).

Reference documentation

The PHP library reference documents what objects and methods are exposed by this library, what arguments they expect and what kind of data is returned.

Most methods also have examples which show you how to use them.

Tutorials & other resources

Upgrade

For details about how to upgrade from version 3.x to version 4, please check the upgrade to version 4 guide.

For details about how to upgrade from version 2.x to version 3, please check the upgrade to version 3 guide.

Reach out to us

You have questions about how to use this library?

You found a bug or want to propose a feature?

You need to share confidential information or have other questions?

Get involved

PRs Welcome

Important: Right now, the API has php-vcr as a development dependency, which does not officially support PHP8 yet. If you want to develop on PHP8, you will need to install the dependencies with composer install --ignore-platform-reqs to overwrite this requirement.

License

This repository is published under the MIT license.

Code of Conduct

We want to provide a safe, inclusive, welcoming, and harassment-free space and experience for all participants, regardless of gender identity and expression, sexual orientation, disability, physical appearance, socioeconomic status, body size, ethnicity, nationality, level of experience, age, religion (or lack thereof), or other identity markers.

Read our full Code of Conduct.


All versions of contentful with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
contentful/core Version ^4.0
contentful/rich-text Version ^4.0
psr/cache Version ^2.0|^3.0
psr/log Version ^1.0|^2.0|^3.0
symfony/cache Version ^5.0|^6.0|^7.0
symfony/console Version ~2.7|~3.0|~4.0|^5.0|^6.0|^7.0
symfony/filesystem Version ~2.7|~3.0|~4.0|~5.0|^6.0|^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package contentful/contentful contains the following files

Loading the files please wait ....