smalot/magento-bundle
Composer 安装命令:
composer require smalot/magento-bundle
包简介
A Symfony2 wrapper for the Magento Soap Client API
README 文档
README
This project is a bridge between Symfony 2 and Magento-Client API which allow to call easily the Magento Soap v1 API.
Allows :
- wrappers for each call
- dependencies injections
- event listeners
- debug toolbar integration
- and ... code completion
Requirements
- Symfony >= 2.1
- PHP >= 5.3
- smalot/magento-client
Installation
Add the following lines to your composer.json:
{
"require": {
"smalot/magento-bundle": "*"
}
}
And run php composer.phar update smalot/magento-bundle
Then, register the bundle in your kernel:
# app/AppKernel.php # ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( # ... new Smalot\MagentoBundle\MagentoBundle(), ); return $bundles; } }
Configuration
You need to setup at least one connection in the connections pool and specify it with the default_connection property.
The mandatory properties are: url, api_user and api_key.
# app/config/config.yml # Sample configuration magento: # Refers to the default connection in the connection pool default_connection: default # Example: default # List all available connections connections: # Prototype default: url: http://domain.tld/magento/ api_user: username api_key: 0123456789AZ # Enable logging system logging: %kernel.debug% # Refers to the logger service logger: ~ # Refers to the dispatcher service dispatcher: ~
Details
Service(s) provided:
- magento
Events thrown in security context:
- \Smalot\MagentoBundle\MagentoEvents::PRE_LOGIN
- \Smalot\MagentoBundle\MagentoEvents::POST_LOGIN
- \Smalot\MagentoBundle\MagentoEvents::PRE_LOGOUT
- \Smalot\MagentoBundle\MagentoEvents::POST_LOGOUT
Events thrown in transport context:
- \Smalot\MagentoBundle\MagentoEvents::PRE_SINGLE_CALL
- \Smalot\MagentoBundle\MagentoEvents::POST_SINGLE_CALL
- \Smalot\MagentoBundle\MagentoEvents::PRE_MULTI_CALL
- \Smalot\MagentoBundle\MagentoEvents::POST_MULTI_CALL
Sample codes
Using the default connection:
class MagentoController extends Controller { /** * @Route("/", name="magento_index") */ public function indexAction(Request $request) { // Retrieve default connection. $magento = $this->get('magento')->getManager(); if ($magento->ping()) { // Call any module's class. $categoryManager = new \Smalot\Magento\Catalog\Category($magento); $tree = $categoryManager->getTree()->execute(); } else { $tree = array(); } $magento->logout(); return new Response('<html><body><pre>' . var_export($tree, true) . '</pre></body></html>'); } }
The connection can be specified manually if needed:
$magento = $this->get('magento')->getManager('second_connection_name');
smalot/magento-bundle 适用场景与选型建议
smalot/magento-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.5k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2014 年 05 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 smalot/magento-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 smalot/magento-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 5.5k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-05-08