seams-cms / delivery-sdk
SDK for the delivery API
Requires
- php: ^7.0
- ext-json: *
- guzzlehttp/guzzle: ^6.3
- ocramius/generated-hydrator: ^2.2|^3.0
- psr/http-message: ^1.0
- symfony/options-resolver: ^3.4|^4.0
Requires (Dev)
- nette/finder: >=2.4
- nette/utils: >=2.5
- phpmd/phpmd: ^2.6
- phpstan/phpstan: ^0.9|^0.12.11
- phpunit/phpunit: ^6.5.0
- sebastian/phpcpd: ^3.0
- squizlabs/php_codesniffer: ^3.4
README
Seams-CMS delivery SDK for PHP
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