PHP code example of bibrokhim / http-clients

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

    

bibrokhim / http-clients example snippets


use Bibrokhim\HttpClients\Clients\PollwonProducts\PollwonProductsClientInterface;

public function index(PollwonProductsClientInterface $client, Request $request)
{
    $categories = $client->siteCategories(
        $request->query('parent_id'),   // null for the root level
        $request->header('Accept-Language'),
        $request->query('slug'),
    );

    return response()->json($categories);
}

public function siteCategories(
    ?string $parentId,
    ?string $language = null,
    ?string $slug = null,
): array;

use Bibrokhim\HttpClients\Clients\PollwonProducts\PollwonProductsClientInterface;

$client = app(PollwonProductsClientInterface::class);

$list    = $client->siteProducts(['category_slug' => 'nasoslar', 'page' => 2], 'uz');
$search  = $client->siteProductSearch(['search' => 'nasos'], 'ru');
$product = $client->siteProduct('0f8fad5b-d9cb-469f-a165-70867728950e', 'uz');
$similar = $client->siteSimilarProducts('0f8fad5b-d9cb-469f-a165-70867728950e', 'uz');

public function siteProducts(array $query = [], ?string $language = null): array;
public function siteProductSearch(array $query = [], ?string $language = null): array;
public function siteProduct(string $productId, ?string $language = null): array;
public function siteSimilarProducts(string $productId, ?string $language = null): array;

$sitemap = $client->siteSitemap();

$points = $client->counterpartiesMapPoints([
    'north' => 41.36,
    'south' => 41.20,
    'east' => 69.38,
    'west' => 69.15,
]);