PHP code example of springimport / magento2-api-v1

1. Go to this page and download the library: Download springimport/magento2-api-v1 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/ */

    

springimport / magento2-api-v1 example snippets



use springimport\magento2\apiv1\Configuration,
    springimport\magento2\apiv1\ApiFactory;

class ApiClient
{

    public static function get()
    {
        $configuration = new Configuration;
        $configuration->setBaseUri('baseUri');
        $configuration->setConsumerKey('consumerKey');
        $configuration->setConsumerSecret('consumerSecret');
        $configuration->setToken('accessToken');
        $configuration->setTokenSecret('tokenSecret');

        return new ApiFactory($configuration);
    }
}

php composer.phar