rem42/scraper-prestashop 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rem42/scraper-prestashop

最新稳定版本:v4.0.3

Composer 安装命令:

composer require rem42/scraper-prestashop

包简介

API Prestashop 1.7

README 文档

README

Packagist version Packagist download Packagist name Packagist php version Github licence Depenabot Codeclimate lines of code Codeclimate maintainability

Scraper can handle multiple request type and transform them into object in order to create some API.

Installation

composer require rem42/scraper-prestashop

Requirement

  • PHP >= 8.1

Usage

Initiate the client with the http client of your choice that implement the Symfony\Contracts\HttpClient\HttpClientInterface interface.

<?php

use Scraper\Scraper\Client;
use Symfony\Component\HttpClient\CurlHttpClient;
use Symfony\Component\HttpClient\NativeHttpClient;

$client = new Client(
    new CurlHttpClient()
    // OR
    new NativeHttpClient()
);

Then you can use the client to make request to the API.

Product list

<?php

use Scraper\ScraperPrestashop\Request\PrestashopGetRequest;
use Scraper\ScraperPrestashop\Entity\PrestashopProducts;

$request = new PrestashopGetRequest(
    'host.com', // Your prestashop host
    'key', // Your prestashop webservice key
    'products', // The resource you want to get, like 'products'
);

// optional for list request
$request
    ->addFilter('limit', 1)
    ->addFilter('offset', 1)
;

/** @var PrestashopProducts $products */
$products = $client->execute($request);

$products->getProducts(); // Return an array of PrestashopProduct

Product detail

<?php

use Scraper\ScraperPrestashop\Request\PrestashopGetRequest;
use Scraper\ScraperPrestashop\Entity\PrestashopProduct;

$request = new PrestashopGetRequest(
    'host.com', // Your prestashop host
    'key', // Your prestashop webservice key
    'products', // The resource you want to get, like 'products'
);

$request->setId(42);

/** @var PrestashopProduct $product */
$product = $client->execute($request);

$product->name; // Return the product name
$product->dateAdd; // Return the product creation date

统计信息

  • 总下载量: 1.81k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-05