PHP code example of sudiptochoudhury / php-api-client-forge

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

    

sudiptochoudhury / php-api-client-forge example snippets





namespace My\Namespace\ApiProvider;

use SudiptoChoudhury\Support\Forge\Api\Client as ApiForge;

class Api extends ApiForge
{

    protected $DEFAULT_API_JSON_PATH = './config/GuzzleDescription.json';
    
    protected $DEFAULTS = [
        'AuthToken' => 'xxxxxxxxxxxxxxxxxxxxxxxxxx',
        'ClientID' => 'xxxxxxxxxxxxxxx',
        'client' => [
            'base_uri' => 'https://api.provider.com/api/v1/',
            'verify' => false,
            'headers' => [
                'Authorization' => 'authtoken {{AuthToken}}',
                'X-clientID' => "{{ClientID}}",
            ],
        ],
    ];

}
 


namespace My\Namespace\ApiProvider;

use SudiptoChoudhury\Support\Forge\Api\Import as ParentImport;

/**
 * Class Import
 *
 * @package Pour\Package\Name
 */
class Import extends ParentImport
{

    protected $DEFAULT_API_JSON_PATH = './config/GuzzleDescription.json';
    protected $DEFAULT_SOURCE_JSON_PATH = './config/postman.json';
    
}



use My\Namespace\ApiProvider\Import;
...
new (Import())->writeDefinition();
...




use SudiptoChoudhury\Support\Forge\Api\Import;

...
new (Import([
   './config/postman.json'
]))->writeDefinition( './config/GuzzleDescription.json');
...


/** 
 * @method	array	getHostedpage(array $parameters)	Getting the details of a particular hosted page
 * @method	array	getHostedpages()	Listing all the hostedpages




		/** This is a filter 
		* @param $apiFunctionName
		* @param array $helperData
	 	* @return string
	 */
    public function filterFinalName($apiFunctionName, $helperData = [])
    {
        if ($apiFunctionName === '_getProducts') {
            $apiFunctionName = 'getActiveProducts';
        }
        return $apiFunctionName;
    }


"sudiptochoudhury/php-api-client-forge": "dev-master"

composer