PHP code example of hashtages / allegro-api-client-php

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

    

hashtages / allegro-api-client-php example snippets




enticator = new \AllegroApi\Authentication\Authenticator(
    new \GuzzleHttp\Client(),
    'https://allegro.pl.allegrosandbox.pl',
    'ALLEGRO_CLIENT_ID', // after add this app to allegro sandbox panel you will get this
    'ALLEGRO_CLIENT_SECRET', // after add this app to allegro sandbox panel you will get this
    'http://uri.where.is.sent.callback/authorization_callback' // after authorization callback will be sent on url (you can use serveo.net localy)
);

echo $authenticator->getAuthorizeUrl();

// This shows url to allegro OAuth, you can redirect in your app to this url in your controller.




iguration = (new \AllegroApi\Configuration())
    ->setHost('https://api.allegro.pl.allegrosandbox.pl')
    ->setAccessToken('access.token.received.from.callback.authorize.url');

$offerManagmentApi = new \AllegroApi\Client\OfferManagementApi(
    new \GuzzleHttp\Client(),
    $configuration
);

$categories = $offerManagmentApi->getCategoriesUsingGET();

var_dump($categories);


composer