fulfillment/oms-api
Composer 安装命令:
composer require fulfillment/oms-api
包简介
A wrapper for Fulfillment's OMS API
README 文档
README
A PHP library that wraps Fulfillment's OMS API for easy use
Example
use Fulfillment\OMS; use Fulfillment\OMS\Models\Request; $apiWrapper = new OmsClient(__DIR__); //instantiate OMS with a configuration file or array of settings $newOrder = new Order($orderData); //create a new Request\Order /* * 1. Validate the order * 2. Make a POST request to /orders * 3. Parse the returned api response into a new Response\Order object */ $createdOrder = $apiWrapper->orders->createOrder($newOrder);
Installation
composer require fulfillment/oms-api
Configuration
Configuration needed is simple:
- USERNAME - Email address for your account
- PASSWORD - Password for your account
- CLIENT_ID - Client Id for your merchant
- CLIENT_SECRET - Client secret for your merchant
- ACCESS_TOKEN - If already created, an access token for your merchant
- API_ENDPOINT - The end point for the fulfillment api services you are using (https://api.fulfillment.com)
Optional Configurations:
- JSON_ONLY - Defaults to false. If set to true all responses will be returned as pure JSON as it is from the server.
There are two ways to configure OMS API
Use dotenv
Use a .env file compatible with fantastic phpdotenv library. Simply specify the absolute path to the folder containing your .env file as an argument in the OMS constructor.
$apiWrapper = new OmsClient('absolute/path/to/a/folder')
An example file called .env.example can be found in the root directory.
Use an array
Alternatively, create an array with key/values matching the above specified configuration and pass it as an argument in the OMS constructor.
$apiWrapper = new OmsClient($yourConfigurationArray)
Usage
Working With Models
Models (plain PHP classes) are used by the wrapper to facilitate easy building, validation, and parsing of api data. There are two types of models:
Request Models
Found at Fulfillment\OMS\Models\Request these are the models that are used when making any request that requires data (such as a POST or PUT request). Currenty you will need to use the implemented models to make these type of requests. They differ slightly from the other type (Response model) because they do not require as much data as is returned from the api.
Example
$newOrder = new Order($myOrderData); $order = $apiWrapper->orders->createOrder($newOrder);
Response Models
Found at Fulfillment\OMS\Models\Response these are the models that response json is parsed in to. They inherit from Request models and so can be reused to make requests.
Example
$returnedOrder = $apiWrapper->orders->getOrder($orderId);
Model Validation
By default all models are validated before a request is sent (in the case of a POST or PUT request). A descriptive error will be thrown if a model has any validation failures. Eventually this will be a configurable option.
Roadmap
There's still lots to do, check the issues section to see what is being worked on or make a request.
fulfillment/oms-api 适用场景与选型建议
fulfillment/oms-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.58k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 08 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「fulfillment」 「fulfillment.com」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 fulfillment/oms-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fulfillment/oms-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 fulfillment/oms-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Linker Cloud Fulfillment Platform API Client library
Magento 2 Twisto payment gateway
A wrapper for Fulfillment's Postage API
Magento 2 Payment Restriction Module
Dialogflow Fulfillment Webhook v1 & v2 - modernize from eristemena/dialogflow-fulfillment-webhook-php
Amazon Marketplace Web Service Fulfillment Inventory API Client Library - PHP - Version 2010-10-01
统计信息
- 总下载量: 8.58k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-13