承接 oihana/php-magento 相关项目开发

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

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

oihana/php-magento

Composer 安装命令:

composer require oihana/php-magento

包简介

Composable PHP client for the Magento 2 REST API. Bundles an OAuth1-signed HTTP client (Guzzle), typed Magento entity schemas (Product, ProductImage, MediaGalleryEntry, ...), composable client traits, and a fluent SearchCriteria builder.

README 文档

README

Oihana PHP Magento

Composable PHP client for the Magento 2 REST API. Part of the Oihana PHP ecosystem, this package bundles an OAuth1-signed HTTP client (Guzzle), typed Magento entity schemas, composable client traits, and a fluent SearchCriteria builder — the building blocks to query the Magento 2 REST API from PHP.

Latest Version Total Downloads License

📚 Documentation

Full API reference (generated with phpDocumentor): https://bcommebois.github.io/oihana-php-magento

User guides (FR + EN) live under wiki/.

📦 Installation

Requires PHP 8.4+ and a Magento 2 instance with REST API access. Install via Composer:

composer require oihana/php-magento

✨ What you can do

  • Talk to Magento 2 over REST through a ready-to-use HTTP client built on Guzzle — OAuth1 signed requests (consumer key + secret + access token + secret) with automatic nonce + timestamp generation, HMAC-SHA1 / HMAC-SHA256 signatures, and proper RFC 5849 query/body parameter handling.
  • Build search criteria fluently — the SearchCriteria helper turns (field, value, condition, group, sortOrder, pageSize, currentPage) tuples into the verbose searchCriteria[filter_groups][...] query parameters Magento expects.
  • Hydrate typed entitiesProduct, ProductImage, MediaGalleryEntry, ProductVideo, ProductMediaGalleryEntriesContent and friends, with field-aware HydrateWith attributes for nested objects.
  • Access product media gallery — composable MagentoProductsTrait exposes products and media-gallery operations on top of the client; the MediaType and ProductImageThumbnail enums make image-role logic explicit.

Under the hood

  • A consistent set of value objects and enums — Magento, MagentoOption, MagentoParam, SearchCriteriaParam, ConditionType — no magic strings.
  • Pure-PHP transport based on GuzzleHttp v7. OAuth1 signing is implemented from scratch in OAuthSigner — no third-party OAuth library required.
  • Hydration delegated to oihana/php-reflect — Magento response payloads map directly to typed objects via the HydrateWith attribute.
  • Schema constants split into trait-composed ProductTrait, ThingTrait, MediaGalleryInterfaceTrait, MediaGalleryEntryTrait — composable in your own DTOs.

✅ Running tests

Run all tests:

composer test

Run a specific test file:

composer test ./tests/oihana/magento/http/OAuthSignerTest.php

The unit tests cover the OAuth1 signer, the search criteria builder, and the field utility helpers — they run without a live Magento instance.

🛠️ Generate the documentation

We use phpDocumentor to generate documentation into the ./docs folder.

composer doc

🧾 License

Licensed under the Mozilla Public License 2.0 (MPL‑2.0).

👤 About the author

  • Author: Marc ALCARAZ (aka eKameleon)
  • Email: marc@ooop.fr
  • Website: https://www.ooop.fr

🔗 Related packages

Package Description
oihana/php-auth Casbin RBAC + JWT/OIDC authorization toolkit.
oihana/php-core Core helpers and utilities shared across the ecosystem.
oihana/php-enums Typed constants and enums — no more magic strings.
oihana/php-exceptions Framework exceptions with consistent semantics.
oihana/php-files File system helpers (paths, readers, writers).
oihana/php-http HTTP helpers — client IP, cookies, route patterns.
oihana/php-openedge Progress OpenEdge SQL toolkit (ODBC, query builder, models).
oihana/php-reflect Reflection and object hydration utilities.
oihana/php-system Framework helpers — controllers, models, request handling.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MPL-2.0
  • 更新时间: 2026-05-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固