sergunik/google-shopping-category-parcer

Download Google Shopping Category, parse it and return as an array or json

v1.1 2021-05-20 08:12 UTC

This package is auto-updated.

Last update: 2024-05-07 20:33:53 UTC


README

Packagist Downloads Scrutinizer build Scrutinizer code quality Scrutinizer coverage (GitHub/BitBucket)

Google Shopping Category Parcer

Download Google Shopping Category, parse it and return as an array or json.

Installation

composer require sergunik/google-shopping-category-parcer

Usage

use GSCP\GSCPService;

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

Or with parameters:

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();

Also you could setup parameters in constructor:

use GSCP\GSCPService;

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