定制 mucan/laravel-magento-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

mucan/laravel-magento-api

Composer 安装命令:

composer require mucan/laravel-magento-api

包简介

Magento 2 REST API Wrapper to export Magento data to use in your Laravel application.

README 文档

README

Build Status Latest Stable Version Style CI Total Downloads License

Laravel - Magento API

A Magento 2 API Object Oriented wrapper for a Laravel application.

Installation

Install this package via Composer:

composer require grayloon/laravel-magento-api

Publish the config options:

php artisan vendor:publish --provider="Mucan\Magento\MagentoServiceProvider" --tag="config"

Configure your Magento 2 API endpoint and token in your .env file:

MAGENTO_BASE_URL="https://mydomain.com"
MAGENTO_ACCESS_TOKEN="client_access_token_here"

# Optional Config:
MAGENTO_BASE_PATH="rest"
MAGENTO_STORE_CODE="all"
MAGENTO_API_VERSION="V1"

API Usage

Example:

use Mucan\Magento\Magento;

$magento = new Magento();
$response = $magento->api('products')->all();

$response->body() : string;
$response->json() : array|mixed;
$response->status() : int;
$response->ok() : bool;

Will throw an exception on >500 errors.

Available Methods:

Admin Token Integration (IntegrationAdminTokenServiceV1)

/V1/integration/admin/token

Generate a admin token:

Magento::api('integration')->adminToken($username, $password);

Bundle Product Options (bundleProductOptionRepositoryV1)

/V1/bundle-products/{sku}/options/all

Get all options for bundle product.

Magento::api('bundleProduct')->options($sku);

Carts

/V1/carts/mine

Returns information for the cart for the authenticated customer. Must use a single store code.

Magento::api('carts')->mine();

/V1/carts/mine/coupons/{couponCode}

Apply a coupon to a specified cart.

Magento::api('carts')->couponCode($couponCode);

Cart Items (quoteCartItemRepositoryV1)

/V1/carts/mine/items/

Lists items that are assigned to a specified customer cart. Must have a store code.

Magento::api('cartItems')->mine();

/V1/carts/mine/items/

Add/update the specified cart item with a customer token. Must have a store code.

Magento::api('cartItems')->addItem($cartId, $sku, $quantity);

put - /V1/carts/mine/items/{itemId}

Update the specified cart item with a customer token. Must have a store code.

Magento::api('cartItems')->editItem($itemId, $body = []);

Remove the specified cart item with a customer token. Must have a store code.

Magento::api('cartItems')->removeItem($itemId);

Cart Totals (quoteCartTotalRepositoryV1)

/V1/carts/mine/totals

Returns information for the cart totals for the authenticated customer. Must use a single store code.

Magento::api('cartTotals')->mine();

Categories (catalogCategoryManagementV1)

/V1/categories

Get a list of all categories:

Magento::api('categories')->all($pageSize = 50, $currentPage = 1, $filters = []);

Customer Token Integration (IntegrationCustomerTokenServiceV1)

/V1/integration/customer/token

Generate a customer token:

Magento::api('integration')->customerToken($username, $password);

Customers (various)

/V1/customers/search

Get a list of customers:

Magento::api('customers')->all($pageSize = 50, $currentPage = 1, $filters = []);

/V1/customers/password

Send an email to the customer with a password reset link.

Magento::api('customers')->password($email, $template, $websiteId);

/V1/customers/resetPassword

Reset customer password.

Magento::api('customers')->resetPassword($email, $resetToken, $newPassword);

Guest Cart (various)

/V1/guest-carts

Enable customer or guest user to create an empty cart and quote for an anonymous customer.

Magento::api('guestCarts')->create();

/V1/guest-carts/{cartId}

Return information for a specified cart.

Magento::api('guestCarts')->cart($cartId);

/V1/guest-carts/{cartId}/items

List items that are assigned to a specified cart.

Magento::api('guestCarts')->items($cartId);

/V1/guest-carts/{cartId}/items

Add/update the specified cart item.

Magento::api('guestCarts')->addItem($cartId, $sku, $quantity);

put - /V1/guest-carts/{cartId}/items/{itemId}

Update the specified cart item.

Magento::api('guestCarts')->editItem($cartId, $itemId, $body = []);

Remove the specified cart item.

Magento::api('guestCarts')->removeItem($cartId, $itemId);

/V1/guest-carts/{cartId}/estimate-shipping-methods

Estimate shipping by address and return list of available shipping methods.

Magento::api('guestCarts')->estimateShippingMethods($cartId);

/V1/guest-carts/{cartId}/coupons/{couponCode}

Apply a coupon to a specified cart.

Magento::api('guestCarts')->couponCode($cartId, $couponCode);

Orders (salesOrderRepositoryV1)

Lists orders that match specified search criteria.

/V1/orders

Magento::api('orders')->all($pageSize = 50, $currentPage = 1, $filters = []);

/V1/orders/{id}

List a specified order:

Magento::api('orders')->show($orderId);

Product Attributes (catalogProductAttributeRepositoryV1)

/V1/products/attributes/{attributeCode}

Retrieve specific product attribute information:

Magento::api('productAttributes')->show($attributeCode);

Product Link Types (catalogProductLinkTypeListV1)

/V1/products/links/types

Retrieve information about available product link types:

Magento::api('productLinkType')->types();

Products (catalogProductRepositoryV1)

/V1/products

Get a list of products:

Magento::api('products')->all($pageSize = 50, $currentPage = 1, $filters = []);

/V1/products/{sku}

Get info about a product by the product SKU:

Magento::api('products')->show($sku);

Custom Modules

Magento modules can have their own API endpoints. For example:

<route method="POST" url="/V1/my-custom-endpoint/save">
    ...
</route>
<route method="GET" url="/V1/my-custom-endpoint/get/:id">
    ...
</route>

To use these you can directly use get/post methods:

Magento::api('my-custom-endpoint')->post('save', [...]);
Magento::api('my-custom-endpoint')->get('get/1');

Schema

Get a schema blueprint of the Magento 2 REST API:

Magento::api('schema')->show(); 

Source Items (inventoryApiSourceItemRepositoryV1)

/V1/inventory/source-items

Get a list of paginated sort items (typically used for quantity retrieval):

Magento::api('sourceItems')->all($pageSize = 50, $currentPage = 1, $filters = []);

Sources (inventoryApiSourcesRepositoryV1)

/V1/inventory/sources

Get a list of paginated sources.

Magento::api('sources')->all($pageSize = 50, $currentPage = 1, $filters = []);

/V1/inventory/sources/{$name}

Get a specified source.

Magento::api('sources')->bySourceName($name);

Stocks (inventoryApiStocksRepositoryV1)

/V1/inventory/stocks

Get a list of paginated stocks.

Magento::api('stocks')->all($pageSize = 50, $currentPage = 1, $filters = []);

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email webmaster@grayloon.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

mucan/laravel-magento-api 适用场景与选型建议

mucan/laravel-magento-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 19 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 01 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 mucan/laravel-magento-api 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

与 mucan/laravel-magento-api 相关的其它包

同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 47
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-25