PHP code example of pramod / php-api-consumer

1. Go to this page and download the library: Download pramod/php-api-consumer 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/ */

    

pramod / php-api-consumer example snippets


Service::consume('fttx-api')
    ->via('customer/pramodk_home')
    ->with([
        'headers'=>[
                    'Authorization'=>'xx',
                    'Content-Type'=>'',
                    'Accept'=>''
                    ],
        'method'=>'POST',
        'version'=>'v1',
        'payload'=>[
            'name'=>'name is here'
        ]
    ])
    ->attach('status_code')
    ->toArray();



return [
    'default'=>[
        'timeout'=>10,
        'ssl_verification'=>true,
        'method'=>"GET"
    ],
    'consumer' => [
        'graphqlTest'=>[
            'baseUri'=>'https://countries.trevorblades.com/',
            'timeout'=>60,
            // 'ssl_verification'=>false //my default its true
        ]
    ]
];


return Api::consume('graphqlTest')
            ->via('fcm/graphql')
            ->with([
                'graphQl'=>[
                    'query'=>'query{
                            continents{
                              code
                              name
                              countries{
                                code
                                name
                                native
                              }
                            }
                          }'
                    ]
            ])
bash
composer 

php vendor/phpunit/phpunit/phpunit