承接 setono/sylius-stock-movement-plugin 相关项目开发

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

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

setono/sylius-stock-movement-plugin

Composer 安装命令:

composer require setono/sylius-stock-movement-plugin

包简介

Plugin to handle stock related activities

README 文档

README

Latest Version Latest Unstable Version Software License Build Status Quality Score

Log all stock movements in your shop. You can use this to create very accurate reports of your inventory movements.

Installation

Step 1: Download the plugin

Open a command console, enter your project directory and execute the following command to download the latest stable version of this plugin:

$ composer require setono/sylius-stock-movement-plugin

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the plugin

Then, enable the plugin by adding it to the list of registered plugins/bundles in the config/bundles.php file of your project:

<?php

return [
    // ...
    
    League\FlysystemBundle\FlysystemBundle::class => ['all' => true],
    Setono\CronExpressionBundle\SetonoCronExpressionBundle::class => ['all' => true],
    Setono\SyliusStockMovementPlugin\SetonoSyliusStockMovementPlugin::class => ['all' => true],
    
    // It is important to add plugin before the grid bundle
    Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true],
        
    // ...
];

NOTE that you must instantiate the plugin before the grid bundle, else you will see an exception like You have requested a non-existent parameter "setono_sylius_stock_movement.model.report_configuration.class".

Step 3: Import routing

# config/routes/setono_sylius_stock_movement.yaml
setono_sylius_stock_movement:
    resource: "@SetonoSyliusStockMovementPlugin/Resources/config/routing.yaml"

Step 4: Configure plugin

# config/packages/setono_sylius_stock_movement.yaml
imports:
    - { resource: "@SetonoSyliusStockMovementPlugin/Resources/config/app/config.yaml" }

setono_sylius_stock_movement:
    templates:
        - label: Default
          template: "@SetonoSyliusStockMovementPlugin/Template/default.txt.twig"

Step 5: Update database schema

Use Doctrine migrations to create a migration file and update the database.

$ bin/console doctrine:migrations:diff
$ bin/console doctrine:migrations:migrate

Step 6: Install assets

$ php bin/console assets:install

Step 7: Using asynchronous transport (optional, but recommended)

All commands in this plugin will extend the CommandInterface. Therefore you can route all commands easily by adding this to your Messenger config:

# config/packages/messenger.yaml
framework:
    messenger:
        routing:
            # Route all command messages to the async transport
            # This presumes that you have already set up an 'async' transport
            # See docs on how to setup a transport like that: https://symfony.com/doc/current/messenger.html#transports-async-queued-messages
            'Setono\SyliusStockMovementPlugin\Message\Command\CommandInterface': async

Step 8 (optional): Create or import fixtures

  • Import fixtures:

    # config/packages/_sylius.yaml
    imports:
        # ...
        - { resource: "@SetonoSyliusStockMovementPlugin/Resources/config/app/fixtures.yaml" }
  • Or create your own:

    # config/fixtures.yaml
    sylius_fixtures:
        suites:
            YOUR_SUITE:
                fixtures:
                    setono_stock_movement:
                        options:
                            amount: 1000

API

Create a stock movement on the variant variant-code with a quantity of 1:

brew install jq
SYLIUS_HOST=http://127.0.0.1:8000
SYLIUS_ADMIN_API_ACCESS_TOKEN=$(curl $SYLIUS_HOST/api/oauth/v2/token \
    --silent --show-error \
    -d "client_id"=demo_client \
    -d "client_secret"=secret_demo_client \
    -d "grant_type"=password \
    -d "username"=api@example.com \
    -d "password"=sylius-api | jq '.access_token' --raw-output)
SYLIUS_SOME_PRODUCT_CODE=$(curl $SYLIUS_HOST/api/v1/products/?limit=1 \
    --silent --show-error \
    -H "Authorization: Bearer $SYLIUS_ADMIN_API_ACCESS_TOKEN" \
    -H "Accept: application/json" | jq '._embedded.items[0].code' --raw-output)
echo "Some product code: $SYLIUS_SOME_PRODUCT_CODE"
SYLIUS_SOME_PRODUCT_VARIANT_CODE=$(curl $SYLIUS_HOST/api/v1/products/$SYLIUS_SOME_PRODUCT_CODE/variants/?limit=1 \
    --silent --show-error \
    -H "Authorization: Bearer $SYLIUS_ADMIN_API_ACCESS_TOKEN" \
    -H "Accept: application/json"| jq '._embedded.items[0].code' --raw-output)
echo "Some product variant code: $SYLIUS_SOME_PRODUCT_VARIANT_CODE"

curl $SYLIUS_HOST/api/v1/stock-movements/ \
  -X POST \
  -H 'Accept: application/json' \
  -H "Authorization: Bearer $SYLIUS_ADMIN_API_ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  -d "{
	\"quantity\": 1,
	\"variant\": \"$SYLIUS_SOME_PRODUCT_VARIANT_CODE\"
}"

setono/sylius-stock-movement-plugin 适用场景与选型建议

setono/sylius-stock-movement-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.17k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2019 年 06 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 setono/sylius-stock-movement-plugin 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-06-12