skoop / php-delivery-sdk

PHP SDK for the Seams-CMS delivery API

Home Page:https://seams-cms.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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\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

About

PHP SDK for the Seams-CMS delivery API

https://seams-cms.com

License:MIT License


Languages

Language:PHP 100.0%