prestashop/ps_apiresources 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

prestashop/ps_apiresources

Composer 安装命令:

composer require prestashop/ps_apiresources

包简介

PrestaShop - API Resources

README 文档

README

Coverage Status

About

Includes the resources allowing using the API for the PrestaShop domain, all endpoints are based on CQRS commands/queries from the Core and we API Platform framework is used as a base.

This module contains no code only some resource files that are automatically scanned and integrated by the Core, these resources are in this folder.

Reporting issues

You can report issues with this module in the main PrestaShop repository. Click here to report an issue.

Under development

Please be aware that this module is still under development, which is why its version is only 0.*. We haven't released a major version 1.0 yet because we anticipate some breaking changes may happen while we add all the missing endpoints.

We aim to maintain backward compatibility as much as possible and never introduce breaking changes, but we also want this API contract to be a fixed standard once it's finalized, so we prefer to polish and refine it before a major version is released.

After the 1.0 version is released it won't include other breaking changes, any breaking change will require a new major version (2.0) and will follow semver convention.

Requirements

Required only for development:

  • composer

Installation

Install all dependencies.

composer install

Run tests locally

Initialize tmp shop environment

First, initialize the test environment with this command that will install a PrestaShop shop in a temporary folder so that the integration tests can run:

composer create-test-db

Customize tmp shop environment

You can define custom values when setting up the tmp shop:

composer clear-test-cache
composer setup-local-tests -- [arguments]
  arguments:
    --force-clone Force cloning the repository even if a cloned repository is detected (when no repository is detected, the clone is automatic)
    --build-assets Force building assets even if they are already built (when no assets are detected, the build is automatic)
    --build-db Force building DB by installing the default shop data (when no DB is detected, the DB shop is installed automatically)
    --update-local-parameters Force copying parameters from the `test/local-parameters` folder (when no parameter file is detectec they are automatically copied)
    --force Force all the previous arguments
    --core-branch Use a specific branch, you can use a branch from the original repository (ex: `develop`, `9.1.x`, ...) or from a fork (ex: `myfork:my-dev-branch`) (By default branch develop is used)

Example:

# To test with 9.1.x branch
composer setup-local-tests -- --force --core-branch=9.1.x

# To test with a branch from your fork (in this example, fork: jolelievre, branch: product-api)
composer setup-local-tests -- --force --core-branch=jolelievre:product-api

Run tests

Then you can run the tests with this command:

composer run-module-tests

Run PHPStan locally

You can run PHPStan locally using the composer script, you will need to specify two variables though:

  • _PS_ROOT_DIR_: path to a local PrestaShop root folder
  • _PS_BRANCH_: which branch you are testing, this impacts the PHPStan config file used which contains specific rules and exceptions, accepted values are develop|9.1.x
# To test with the develop branch
_PS_ROOT_DIR_=/path/to/prestashop-develop _PS_BRANCH_=develop composer phpstan

# To test with the 9.1.x branch
_PS_ROOT_DIR_=/path/to/prestashop-91x _PS_BRANCH_=9.1.x composer phpstan

Each config uses a différent cache folders stored in var/phpstan-tmp but you can easily pollute it if:

  • you run the command multiple times with mixed variables (_PS_ROOT_DIR_ and _PS_BRANCH_ don't match)
  • you change your branch in _PS_ROOT_DIR_ but the cache was already generated with the previous branch

You can remove the var/phpstan-tmp cache to reset the cache.

You can also use the composer script to update the baseline to include exceptions for specific versions:

# To test with the develop branch (this should updated phpstan-9.1.x.neon only)
_PS_ROOT_DIR_=/path/to/prestashop-91x _PS_BRANCH_=9.1.x composer phpstan-baseline

Make sure you use the correct two variables and your cache is correct ro you will add the wrong exceptions for the wrong branch. This composer script will generate a dedicated baseline file, but the rules should be included in the existing phpstan config for the branch.

Contributing

The PrestaShop Admin API provides RESTful endpoints for managing your store programmatically. Everyone is welcome to contribute by adding new API endpoints!

Please read our contributing guide before starting:

Need help or believe core improvements are needed? Reach out to the team on Slack, and #cfc-adminapi channel - we're here to help!

Also, follow our general contribution guidelines.

License

This module is released under the Academic Free License 3.0

prestashop/ps_apiresources 适用场景与选型建议

prestashop/ps_apiresources 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 833.21k 次下载、GitHub Stars 达 13, 最近一次更新时间为 2023 年 10 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 833.21k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 13
  • 点击次数: 8
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 13
  • Watchers: 24
  • Forks: 44
  • 开发语言: PHP

其他信息

  • 授权协议: AFL-3.0
  • 更新时间: 2023-10-05