承接 digitalprint/oro-api-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

digitalprint/oro-api-php

最新稳定版本:v1.2.0

Composer 安装命令:

composer require digitalprint/oro-api-php

包简介

OroCommerce API client for PHP applications.

README 文档

README

Thank you for using the "OroCommerce Api PHP Client" (Digitalprint_Oro-Api-PHP).

This package contains some basic functions you need to connect php applications with your OroCommerce system.

This package contains only a few endpoints. If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".

Latest Stable Version Total Downloads

1. Documentation

2. How to install

Install via composer (recommend)

Run the following command in your root folder:

composer require digitalprint/oro-api-php

3. User Guide

This package integrates OroCommerce API functions into your php application.

3.1 Getting started

Initializing the OroCommerce API client.

$oro = new \Digitalprint\Oro\Api\OroApiClient();
$oro->setApiEndpoint('YOUR_ORO_API_ENDPOINT');
$oro->setUser('YOUR_ORO_API_USER');

$res = $oro->authorization->create([
    'client_id' => 'YOUR_CLIENT_ID',
    'client_secret' => 'YOUR_CLIENT_SECRET',
]);

$oro->setAccessToken($res->access_token);

3.2 Product Examples

Get a single product

$product = $oro->products->get(100);

Get a single product with related entities included

$oro->products->get(1, ['include' => 'names,descriptions']);

Get a list of products

$products = $oro->products->page();

Get a list of featured products

$products = $oro->products->page(1, 10, ['featured' => true]);

Get names of a product

$names = $oro->products->get(100)->names();

Update an existing product

$product = $oro->products->get(100);

$res = $product->update([
  'data' => [
    'meta' => [
      'update' => true,
    ],
    'type' => 'products',
    'id' => $product->id,
    'attributes' => [
      'status' => ($product->attributes->status === 'disabled' ? "enabled" : "disabled"),
    ],
  ],
]);

Create a new product

$product = $oro->products->create([
  'data' => [
    'type' => 'products',
    'attributes' => [
      'sku' => 'test-api-' . strtotime('now'),
      'status' => 'enabled',
      'variantFields' => [],
      'productType' => 'simple',
      'featured' => true,
      'newArrival' => false,
      'availability_date' => '2018-01-01',
    ],
    'relationships' => [ ... ],
  ],
  'included' => [ ... ],
]);

Delete a single product

$names = $oro->products->get(100)->delete();

3.3 More Examples

More examples are in the examples folder

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-2-Clause
  • 更新时间: 2021-12-29