Download the PHP package cobwebinfo/cobra5-php-sdk without Composer
On this page you can find all versions of the php package cobwebinfo/cobra5-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package cobra5-php-sdk
COBRA5 PHP SDK
The COBRA5 API can be used to retrieve content from the Cobweb Information Ltd content API.
This repository contains the open source PHP SDK for integrating the COBRA5 API into your PHP application. The COBRA5 PHP SDK is licensed under the MIT license.
This package requires PHP >= 7.0.0
. Please refer to version 1.0.x if you are using older versions of PHP.
In order to gain access to the COBRA5 API, you will require an API Key that will be issued by Cobweb Information Ltd. You will also receive complete documentation on each of the resources of the COBRA5 API, as well as example requests and responses.
Installation
Add cobwebinfo/cobra5-php-sdk
as a requirement to composer.json
:
Authentication
The COBRA5 API is based on open standards known collectively as web services, which includes Simple Object Access Protocal (SOAP), Web Services Definition Language (WSDL) and the XML Schema Definition Language (XSD).
In order to authenticate with the COBRA5 API, you will need to create a SoapClient
and set the correct authorisation header. This can be achieved using the service classes within this repository:
First, create a new SoapClient
and pass the URI of the WSDL:
Next, create a new SoapApiKeyAuthentication
object and pass the name of the SoapHeader
and your api_key
as arguments:
Next, create a new Cobra5SoapClient
and pass the SoapClient
and SoapApiKeyAuthentication
objects as arguments:
Finally, create a new instance of Cobra5
and pass the Cobra5SoapClient
object as the argument:
Return values
Each of the methods of the COBRA5 PHP SDK will return either a collection or an entity.
A collection is an iteratable object that implements a numer of helper methods for working with collections of resources. The collection will be an instance of Illuminate\Support\Collection
.
Each entity has a number of methods that make working with entity objects easier. Certain entities also have additional helper methods. You can find the entity classes under CobwebInfo\Cobra5Sdk\Entity
.
Available methods
The following is a list of available methods and how you would call them on the $cobra5
object. For a more detailed overview of the methods, requests and responses of the COBRA5 API, please consult the documentation that was provided with your API key.
The getStores()
method will return a Illuminate\Support\Collection
of the datastores that you have access to through your API key.
The getStore()
method will return a CobwebInfo\Cobra5Sdk\Entity\Datastore
instance.
The getStoreByName()
method will return a CobwebInfo\Cobra5Sdk\Entity\Datastore
instance.
The getDocuments()
method will return a Illuminate\Support\Collection
of the documents that you have access to through your API key.
The getDocument()
method will return a CobwebInfo\Cobra5Sdk\Entity\Document
instance.
The getLastEditedDocument()
method will return the last edited document in the system as a CobwebInfo\Cobra5Sdk\Entity\Document
instance.
The getEditedDocuments()
method will return a Illuminate\Support\Collection
of documents that were edited between two unix timestamps.
The getDocumentsByDataStore()
method will return a Illuminate\Support\Collection
of documents that are available to you through a particular datastore.
The getDocumentsForCategory()
method will return a Illuminate\Support\Collection
of documents that are available to you through a particular category.
The getCategory()
method will return a CobwebInfo\Cobra5Sdk\Entity\Category
instance.
The getCategoriesForStore()
method will return a Illuminate\Support\Collection
of categories that are available to you through a particular datastore.
The getDocumentXml()
method will return the XML version of a document as a string.
The getDocumentPdf()
method will return the PDF version of a document as a base64 encoded string.
The getDocumentHtml(1444)
method will return the HTML version of a document as a string.
The documentSearch()
method will allow you to search the API for a particular term. You will be returned a Illuminate\Support\Collection
of results.
Errors and Exceptions
If a problem occurs whilst using the COBRA5 API a SoapFault
exception will be thrown. This exception can be caught and dealt with gracefully within your application: