Download the PHP package kontent-ai/delivery-sdk-php without Composer

On this page you can find all versions of the php package kontent-ai/delivery-sdk-php. 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 delivery-sdk-php

Kontent.ai Delivery SDK for PHP

Build & Test & Report Packagist codecov Stack Overflow Discord

Summary

The Kontent.ai Delivery PHP SDK is a client library used for retrieving content from Kontent.ai. The best way to use the SDK is to consume it in the form of a Packagist package. The library currently supports only PHP 8 and above.

Sample site

Check out a sample site running on Laravel utilizing this SDK here: https://github.com/kontent-ai/sample-app-php

Installation

The best way to install the client is through a dependency manager called Composer:

or adjusting your composer.json file:

Autoloading

Writing object-oriented applications requires one PHP source file per class definition. One of the biggest annoyances is having to write a long list of needed includes at the beginning of each script (one for each class).

Since the SDK uses Composer dependency manager and specifies autoload information, Composer generates a vendor/autoload.php file. You can simply include this file and start using the namespaces that those libraries offer without any extra work:

Using the DeliveryClient

The DeliveryClient class is the main class of the SDK. Using this class, you can retrieve content from your Kontent.ai projects.

To create an instance of the class, you need to provide a project ID.

There are some other optional parameters that you can use during the DeliveryClient instantiation.

Once you create a DeliveryClient, you can start querying your project repository by calling methods on the client instance. See Basic querying for details.

Basic querying

Once you have a DeliveryClient instance, you can start querying your project repository by calling methods on the instance.

Filtering retrieved data

The SDK supports full scale of the API querying and filtering capabilities as described in the API reference.

Getting localized items

The language selection is just a matter of specifying one additional filtering parameter to the query.

Working with taxonomies

To retrieve information about your taxonomies, you can use the getTaxonomy and getTaxonomies methods. Additionally, you can specify query parameters.

Previewing unpublished content

To retrieve unpublished content, you need to create a DeliveryClient with both Project ID and Preview API key. Each Kontent.ai project has its own Preview API key.

For more details, see Previewing unpublished content using the Delivery API.

Response structure

For full description of single and multiple content item JSON response formats, see our API reference.

Single content item response

When retrieving a single content item, you get an instance of the ContentItem class. This class contains a 'system' property (with metadata about the content item, such as code name, display name, type, collection, or sitemap location) and respective content item's elements projected as camelCase properties.

Multiple content items response

When retrieving a list of content items, you get an instance of the ContentItemsResponse. This class represents the JSON response from the Delivery API endpoint and contains:

Properties and their types

Mapping custom models

It's possible to instruct the SDK to fill and return your own predefined models. To do that you have to implement:

The default implementation of all the interfaces can be found in a class called DefaultMapper.

Example:

The ArticleModel can then look like this (and contain only the properties you need to work with):

Feedback & Contributing

Check out the contributing page to see the best places to file issues, start discussions, and begin contributing.

  1. Clone the repository
  2. Run composer install to install dependencies
  3. Run phpunit to verify that everything works as expected

Developing on Windows

Have a look at our cool tutorial on developing PHP on Windows with Visual Studio Code!

Developing on Linux

Do you prefer penguins? Check out our tutorials on developing PHP on Linux with PhpStorm!

Wall of Fame

We would like to express our thanks to the following people who contributed and made the project possible:

Would you like to become a hero too? Pick an issue and send us a pull request!


All versions of delivery-sdk-php with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0 || ^8.0
nategood/httpful Version ^0.2.20
kub-at/php-simple-html-dom-parser Version ^1.9
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 kontent-ai/delivery-sdk-php contains the following files

Loading the files please wait ....