承接 openfoodfacts/openfoodfacts-php 相关项目开发

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

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

openfoodfacts/openfoodfacts-php

Composer 安装命令:

composer require openfoodfacts/openfoodfacts-php

包简介

Open Food Facts API Wrapper, the open database about food.

README 文档

README

PHP API Wrapper for Open Food Facts, the open database about food.

Project Status Build Status Average time to resolve an issue Percentage of issues still open

Current features

Installation

With Composer:

composer require openfoodfacts/openfoodfacts-php

Usage

This is the most basic way of creating the API:

$api = new OpenFoodFacts\Api('food','fr');
$product = $api->getProduct('3057640385148');

In the example above you access the "food" database, limited to the French language/country scope. The first parameter is either

  • "food"
  • "beauty" or
  • "pet"

to decide which product database you want to use.

The second parameter decides the language/country scope of the chosen database: f.e. "world" or "de" or "fr".

For more details on this topic: see the API Documentation

These are all the parameters you really need for basic usage.

As return types for $api->getProduct you get an Document::class Object. This may also be an Object of Type FoodProduct::class,PetProduct::class, BeautyProduct::class depending on which API you are creating. These objects inherit from the more generic Document::class

In the example above, we use the 'food' API and there will get a FoodProduct::class

For getting a first overview the Document::class has a function to return an array representation(sorted) for a first start.

$product = $api->getProduct('3057640385148');
$productDataAsArray = $product->getData();

Optional Parameters

The other parameters are optional and for a more sophisticated use of the api (from a software development point of view):

An example in code is found here: cached_example.php

LoggerInterface: A logger which decieds where to log errors to (file, console , etc)

see: PSR-3 Loggerinterface

ClientInterface: The HTTP Client - to adjust the connection configs to your needs and more

see: Guzzle HTTP Client

CacheInterface: To temporarily save the results of API request to improve the performance and to reduce the load on the API- Server

see: PSR-16 Simple Cache

Development

Contributing

  1. Fork it ( https://github.com/openfoodfacts/openfoodfacts-php/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Launch test vendor/bin/phpunit && cs-fixer vendor/bin/php-cs-fixer fix
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request

Using this SDK and Third party applications

  • If you use this SDK, feel free to open a PR to add your application in the list in REUSERS.md
  • Make sure you comply with the OdBL licence, mentioning the Source of your data, and ensuring to avoid combining non free data you can't release legally as open data. Another requirement is contributing back any product you add using this SDK.
  • Please get in touch at reuse@openfoodfacts.org
  • We are very interested in learning what the Open Food Facts data is used for. It is not mandatory, but we would very much appreciate it if you tell us about your re-uses (https://forms.gle/hwaeqBfs8ywwhbTg8) so that we can share them with the Open Food Facts community. You can also fill this form to get a chance to get your app featured: https://forms.gle/hwaeqBfs8ywwhbTg8

Authors

openfoodfacts/openfoodfacts-php 适用场景与选型建议

openfoodfacts/openfoodfacts-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 45.4k 次下载、GitHub Stars 达 71, 最近一次更新时间为 2019 年 01 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 openfoodfacts/openfoodfacts-php 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 71
  • Watchers: 16
  • Forks: 40
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-23