承接 braghetto/hokoml 相关项目开发

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

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

braghetto/hokoml

Composer 安装命令:

composer create-project braghetto/hokoml

包简介

Package to simplify the communication between the Mercado livre API and your app.

README 文档

README

Package to simplify the integration between the Mercado livre API and your app.

Table of Contents

Installation

composer require braghetto/hokoml

Configs

<?php
$config = [
    /**
    * Get app_id, secret_key and redirect_uri in te ML application manager (http://applications.mercadolibre.com/)
    */
    'app_id' => 'YOUR_APP_ID',

    'secret_key' => 'YOUR_SECRET_KEY',

    'redirect_uri' => 'YOUR_REDIRECT_URI',

    'production' => false,

    /**
    * The ML code for your country
    *
    * MLA => Argentina
    * MBO => Bolivia
    * MLB => Brazil
    * MLC => Chile
    * MCO => Colombia
    * MCR => Costa Rica
    * MCU => Cuba
    * MRD => Dominican Republic
    * MEC => Ecuador
    * MGT => Guatemala
    * MHN => Honduras
    * MLM => Mexico
    * MNI => Nicaragua
    * MPA => Panama
    * MPY => Paraguay
    * MPE => Peru
    * MPT => Portugal
    * MSV => Salvador
    * MLU => Uruguay
    * MLV => Venezuela
    */
    'country' => 'YOUR_COUNTRY_CODE'
]

Usage

Authentication

Get auth url

Retrive the auth to authorize your app.

<?php
use Braghetto\Hokoml\Hokoml;

$hokoml = new Hokoml($config);
$url = $hokoml->getAuthUrl();

Authorize

Once you have the code retrive the access token, user id, expiration and a refresh token.

<?php
use Braghetto\Hokoml\Hokoml;

$hokoml = new Hokoml($config);
$response = $hokoml->authorize($_GET['code']);
// Persist the data for future usage...

Refresh access token

<?php
use Braghetto\Hokoml\Hokoml;

$hokoml = new Hokoml($config);
// $refresh_token saved from your previous authorization
$response = $hokoml->refreshAccessToken($refresh_token);

Product

Create

<?php
use Braghetto\Hokoml\Hokoml;

$hokoml = new Hokoml($config, $_SESSION['access_token'], $_SESSION['user_id']);
$response = $hokoml->product()->create([
    'title' => 'TESTE RAY BAN',
    'category_id' => 'MLB1227',
    'price' => 900000,
    'currency_id' => 'BRL',
    'available_quantity' => 1,
    'buying_mode' => 'buy_it_now',
    'listing_type_id' => 'free',
    'automatic_relist' => false,
    'condition' => 'new',
    'description' => 'Item:, <strong> Ray-Ban WAYFARER Gloss Black RB2140 901 </strong> Model: RB2140. Size: 50mm. Name: WAYFARER. Color: Gloss Black. Includes Ray-Ban Carrying Case and Cleaning Cloth. New in Box',
    'warranty' => '12 month by Ray Ban',
    'pictures' => [
        ['source' => 'https://upload.wikimedia.org/wikipedia/commons/f/fd/Ray_Ban_Original_Wayfarer.jpg'],
        ['source' => 'https://upload.wikimedia.org/wikipedia/commons/a/ab/Teashades.gif']
    ]
]);

Find product

<?php
use Braghetto\Hokoml\Hokoml;

$hokoml = new Hokoml($config, $_SESSION['access_token'], $_SESSION['user_id']);
$response = $hokoml->product()->find($product_id);

Update

Not all information can be update, so the packge will filter those info. Details here

<?php
// [...]
$response = $hokoml->product()->update($product_id, [
    'title' => 'Milibin',
    'price' => 800000,
    'warranty' => 'New warranty', // Won't be updated
    // [...]
]);

Pause

<?php
// [...]
$response = $hokoml->product()->pause($product_id);

Unpause

<?php
// [...]
$response = $hokoml->product()->unpause($product_id);

Finalize

<?php
// [...]
$response = $hokoml->product()->finalize($product_id);

Relist

<?php
// [...]
$response = $hokoml->product()->relist($product_id, $price);
// $response = $hokoml->product()->relist($product_id, $price, $quantity = 1, $listing_type = 'free');

Delete

<?php
// [...]
$response = $hokoml->product()->delete($product_id);

Category

List

<?php
use Braghetto\Hokoml\Hokoml;

$hokoml = new Hokoml($config, $_SESSION['access_token'], $_SESSION['user_id']);
// List all root categories
$response = $hokoml->category()->list();

// List children categories for a given id.
$response = $hokoml->category()->list($parent_category_id);

Predict

Predict a category for a given title.

<?php
// [...]
$response = $hokoml->category()->predict('Rayban Gloss Black');

Questions

Ask

<?php
use Braghetto\Hokoml\Hokoml;

$hokoml = new Hokoml($config, $_SESSION['access_token'], $_SESSION['user_id']);
$response = $hokoml->question()->ask($question_id, 'The questions.');

Find question

<?php
// [...]
$response = $hokoml->question()->find($question_id);

Answer

<?php
// [...]
$response = $hokoml->question()->answer($question_id, 'The answer.');

Questions from product

List all questions from a product.

<?php
// [...]
$response = $hokoml->question()->fromProduct($product_id);

// with filters
$response = $hokoml->question()->fromProduct($product_id, [
	'status' => 'unanswered',
	[...]
]);

// with filters and sorting
$response = $hokoml->question()->fromProduct($product_id, ['status' => 'unanswered'], 'date_desc');

Unanswered from product

List all unanswered questions from a product.

<?php
// [...]
$response = $hokoml->question()->unansweredFromProduct($product_id);

Block user

<?php
// [...]
$response = $hokoml->question()->blockUser($user_id);

Unblock user

<?php
// [...]
$response = $hokoml->question()->unblockUser($user_id);

Blocked users

List blocked users.

<?php
// [...]
$response = $hokoml->question()->blockedUsers();

Received questions

<?php
// [...]
$response = $hokoml->question()->received();

//With filters
$response = $hokoml->question()->received([
	'status' => 'unanswered'
]);

//With filters and sorting
$response = $hokoml->question()->received(['status' => 'unanswered'], 'date_desc');

User

Me

<?php
use Braghetto\Hokoml\Hokoml;

$hokoml = new Hokoml($config, $_SESSION['access_token'], $_SESSION['user_id']);
$response = $hokoml->user()->me();

Find user

<?php
[...]
$response = $hokoml->user()->find($user_id);

Addresses

Retrive the authenticated user addresses.

<?php
[...]
$response = $hokoml->user()->addresses();

Accepted payment methods

Retrive payment methods accepted by the authenticated user.

<?php
[...]
$response = $hokoml->user()->acceptedPaymentMethods();

License

This project is licensed under the MIT License - see the license.md file for details

braghetto/hokoml 适用场景与选型建议

braghetto/hokoml 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 454 次下载、GitHub Stars 达 2, 最近一次更新时间为 2016 年 11 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「Mercado livre」 「Mercado libre」 「Mercado livre API」 「Mercado libre API」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 braghetto/hokoml 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 braghetto/hokoml 我们能提供哪些服务?
定制开发 / 二次开发

基于 braghetto/hokoml 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-11-20