PHP code example of silverstripe-terraformers / openapi-codegen-php-8

1. Go to this page and download the library: Download silverstripe-terraformers/openapi-codegen-php-8 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/ */

    

silverstripe-terraformers / openapi-codegen-php-8 example snippets


namespace Fancy\Client;

class ClientBuilder extends \Elastic\OpenApi\Codegen\AbstractClientBuilder
{
    /**
     * Return the configured client.
     *
     * @return \Fancy\Client\Client
     */
    public function build()
    {
        return new Client($this->getEndpointBuilder(), $this->getConnection());
    }

    /**
     * Endpoint builder is in charge of resolving the endpoint classes.
     * Need to be configured with your own namespace.
     */
    protected function getEndpointBuilder()
    {
        return new \Elastic\OpenApi\Codegen\Endpoint\Builder(__NAMESPACE__ . '\Endpoint');
    }
}

$clientBuilder = new \Fancy\Client\ClientBuilder();
$client = $clientBuilder->build();