seams-cms/delivery-sdk

SDK for the delivery API

0.0.9 2020-02-20 14:10 UTC

This package is auto-updated.

Last update: 2024-04-21 00:07:45 UTC


README

Seams-CMS delivery SDK for PHP

Packagist Build Status Scrutinizer Code Quality Code Coverage

This repository hosts the SDK for the Seams-CMS delivery API.

Usage

Before installing, make sure you have an Seams-CMS account with an API key. This information is needed in the SDK.

$factory = new SeamsCMS\Delivery\ClientFactory(<apiKey>, <workspace>);
$client = $factory->build();

$collection = $client->getWorkspaceCollection();
echo "Your workspace name: " . $collection->getEntries()[0]->getName() . PHP_EOL;

Using the image builder

The image builder allows you to simply generate images based on your assets. It consists of a fluent interface that allows you to simple add commands to the builder. When calling getSourceUrl, the builder will take all commands and generate a URL that points to the actual image.

$imageSrc = $imageBuilder::fromPath(<workspace>, <asset>)
    ->width(100)
    ->height(100)
    ->negate()
    ->getSourceUrl()
;

echo "<img src=\"$imageSrc\">";

Contributing

Please read the CONTRIBUTION file for more information on how to contribute.

Running tests

Note that when running tests, you must install all the composer packages first. Run composer install in the current directory to install all (development) packages before running the tests.

Running all tests:

composer tests

To run only the unit-tests:

./vendor/bin/phpunit