PHP code example of auto1-oss / service-api-client-bundle

1. Go to this page and download the library: Download auto1-oss/service-api-client-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

auto1-oss / service-api-client-bundle example snippets


class PostUnicorn implements ServiceRequestInterface
{
    private $horn;

    public function setHorn(string $horn): self
    {
        $this->horn = $horn;

        return $this;
    }

    public function getHorn()
    {
        return $this->horn;
    }
}


class UnicornRepository
{
    public function __construct(APIClientInterface $apiClient,)
    {
        $this->apiClient = $apiClient;
    }

    /**
     * @param string $horn
     *
     * @return Unicorn[]
     */
    public function getListByHorn(string $horn): array
    {
        $serviceRequest = (new GetUnicornsByHornRequest())->setHorn($horn);

        return $this->apiClient->send($serviceRequest);
    }
}