itk-dev/getorganized-api-client-php

PHP client for GetOrganized API

1.2.1 2023-12-18 08:25 UTC

README

Installation

composer require itk-dev/getorganized-api-client-php

Usage

use ItkDev\GetOrganized\Client;

$client = new Client($username, $password, $webApplicationUrl);

// Get specific service, e.g. tiles or cases

$tilesService = $client->api('tiles');

$tiles = $tilesService->GetTilesNavigation();

Services

To group GetOrganized API endpoints that consider specific GetOrganized modules or entities, e.g. Tiles or Cases, we create services that extend the abstract ItkDev\GetOrganized\Service class.

Example Tiles service

<?php

namespace ItkDev\GetOrganized\Service;

use ItkDev\GetOrganized\Service;

class Tiles extends Service
{
    protected function getApiBaseUrl(): string
    {
        return '/_goapi/Administration/';
    }

    public function GetTilesNavigation()
    {
        return $this->getData(
            'GET',
            $this->getApiBaseUrl().__FUNCTION__,
            []
        );
    }
}

Development

Tests

docker run --interactive --tty --rm --volume ${PWD}:/app itkdev/php8.1-fpm:latest composer install
docker run --interactive --tty --rm --volume ${PWD}:/app itkdev/php8.1-fpm:latest vendor/bin/phpunit

Coding standards

The following commands let you test that the code adheres to the coding standards:

docker run --interactive --tty --rm --volume ${PWD}:/app itkdev/php8.1-fpm:latest composer install
docker run --interactive --tty --rm --volume ${PWD}:/app itkdev/php8.1-fpm:latest composer coding-standards-check

Automatically fix some coding standards issues by running

docker run --interactive --tty --rm --volume ${PWD}:/app itkdev/php8.1-fpm:latest composer coding-standards-apply

Code analysis

docker run --interactive --tty --rm --volume ${PWD}:/app itkdev/php8.1-fpm:latest composer install
docker run --interactive --tty --rm --volume ${PWD}:/app itkdev/php8.1-fpm:latest composer code-analysis