PHP code example of sergunik / google-shopping-category-parcer

1. Go to this page and download the library: Download sergunik/google-shopping-category-parcer 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/ */

    

sergunik / google-shopping-category-parcer example snippets


use GSCP\GSCPService;

$service = new GSCPService();
$array = $service->toArray();
//or echo $service->toJson();

use GSCP\GSCPService;

$service = new GSCPService();
$service->setLocale('uk_UA') //or other format uk-UA
    ->setFilename('storage/my-local-file.txt') //if you want to specify cache file
    ->setColumns([ //these columns by default 
        'id',
        'name',
        'parentId',
        'parents',
        'children',
    ])  
    ->toArray();

use GSCP\GSCPService;

$service = new GSCPService([
    'locale' => 'uk_UA',
    'filename' => 'storage/my-local-file.txt',
    'columns' => ['id', 'name']
]);
$service->toArray();