PHP code example of ghiyam / apix

1. Go to this page and download the library: Download ghiyam/apix 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/ */

    

ghiyam / apix example snippets




[
    // ...
    'modules'    =>
        [
            'apix' => [
                'class' => 'ghiyam\apix\APIx',
                'controllerMap' => [
                    // API service with REST client example
                    'some_vendor'    =>
                        [
                            // default controller class is abstract, use inheritance instead
                            'class'      => 'ghiyam\apix\controller\ServiceController',
                            'service' =>
                                [
                                    'client' => [
                                        // default client class is abstract, use inheritance instead
                                        'class'         => '\ghiyam\apix\clients\CurlApiClient',
                                        'credentials'   => [],
                                        'clientOptions' => [
                                            'host'    => 'someHost',
                                            'port'    => 443,
                                            'uri'     => 'path/to/api/uri',
                                            'timeout' => 3,
                                        ]
                                    ],
                                ],
                        ],
                    // API service with SOAP client example
                    'another_vendor' =>
                        [
                            // default controller class is abstract, use implementation instead
                            'class'      => 'ghiyam\apix\controller\ServiceController',
                            'service' =>
                                [
                                    'client' => [
                                        // default client class is abstract, use inheritance instead
                                        'class'       => '\ghiyam\apix\clients\SoapApiClient',
                                        'credentials' => [],
                                        'namespaces'  =>
                                            [
                                                'header'   => '',
                                                'envelope' => '',
                                            ],
                                        'clientOptions' => [
                                            'location'     => '',
                                            'uri'          => '',
                                            'trace'        => true,
                                            'compression'  => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP,
                                            'exceptions'   => false,
                                            'soap_version' => SOAP_1_1,
                                            'encoding'     => 'UTF-8',
                                        ],
                                    ],
                                ],
                        ]
                    // ... any other API clients implementations...
                ],
            ],
        ],
    //...
]