{"id":14109484,"url":"https://github.com/openfoodfacts/openfoodfacts-php","last_synced_at":"2025-05-16T15:04:54.225Z","repository":{"id":44655543,"uuid":"61487108","full_name":"openfoodfacts/openfoodfacts-php","owner":"openfoodfacts","description":"PHP wrapper for Open Food Facts","archived":false,"fork":false,"pushed_at":"2025-01-23T17:03:03.000Z","size":13964,"stargazers_count":60,"open_issues_count":12,"forks_count":37,"subscribers_count":17,"default_branch":"develop","last_synced_at":"2025-04-10T19:49:24.533Z","etag":null,"topics":["food","hacktoberfest","php","php-wrapper"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/openfoodfacts/openfoodfacts-php","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openfoodfacts.png","metadata":{"funding":{"patreon":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"open_collective":"openfoodfacts-server","github":"openfoodfacts","custom":"https://donate.openfoodfacts.org"},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-19T15:37:09.000Z","updated_at":"2024-12-09T09:08:11.000Z","dependencies_parsed_at":"2022-08-02T22:15:22.081Z","dependency_job_id":"54da130f-e28b-4b2e-8096-82e30de31a93","html_url":"https://github.com/openfoodfacts/openfoodfacts-php","commit_stats":{"total_commits":132,"total_committers":22,"mean_commits":6.0,"dds":0.7272727272727273,"last_synced_commit":"3b835ec74819556e1b39f00cd6734cdb51bd57c7"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfoodfacts%2Fopenfoodfacts-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfoodfacts%2Fopenfoodfacts-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfoodfacts%2Fopenfoodfacts-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfoodfacts%2Fopenfoodfacts-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openfoodfacts","download_url":"https://codeload.github.com/openfoodfacts/openfoodfacts-php/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248590628,"owners_count":21129862,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["food","hacktoberfest","php","php-wrapper"],"created_at":"2024-08-14T10:02:20.360Z","updated_at":"2025-04-12T15:38:55.195Z","avatar_url":"https://github.com/openfoodfacts.png","language":"PHP","funding_links":["https://opencollective.com/openfoodfacts-server","https://github.com/sponsors/openfoodfacts","https://donate.openfoodfacts.org"],"categories":["PHP"],"sub_categories":[],"readme":"# openfoodfacts-php - Official PHP package for Open Food Facts\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://static.openfoodfacts.org/images/logos/off-logo-horizontal-dark.png?refresh_github_cache=1\"\u003e\n  \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://static.openfoodfacts.org/images/logos/off-logo-horizontal-light.png?refresh_github_cache=1\"\u003e\n  \u003cimg height=\"48\" src=\"https://static.openfoodfacts.org/images/logos/off-logo-horizontal-light.svg\"\u003e\n\u003c/picture\u003e\n\nPHP API Wrapper for [Open Food Facts](https://openfoodfacts.org/), the open database about food.\n\n[![Project Status](https://opensource.box.com/badges/active.svg)](https://opensource.box.com/badges)\n[![Build Status](https://travis-ci.org/openfoodfacts/openfoodfacts-php.svg?branch=master)](https://travis-ci.org/openfoodfacts/openfoodfacts-php)\n[![Average time to resolve an issue](https://isitmaintained.com/badge/resolution/openfoodfacts/openfoodfacts-php.svg)](https://isitmaintained.com/project/openfoodfacts/openfoodfacts-php \"Average time to resolve an issue\")\n[![Percentage of issues still open](https://isitmaintained.com/badge/open/openfoodfacts/openfoodfacts-php.svg)](https://isitmaintained.com/project/openfoodfacts/openfoodfacts-php \"Percentage of issues still open\")\n\n## Current features\n* Search-A-Licious (#62), user-agent (#53), PHP 8.1 (#47), Image upload\n* Most features should be visible here: https://github.com/openfoodfacts/openfoodfacts-php/blob/develop/src/Api.php\n* PLEASE DOCUMENT ANY MISSING FEATURES HERE\n\n## Installation\n\nWith Composer:\n\n```bash\ncomposer require openfoodfacts/openfoodfacts-php\n```\n\n## Usage\nThis is the most basic way of creating the API:\n```php\n$api = new OpenFoodFacts\\Api('food','fr');\n$product = $api-\u003egetProduct('3057640385148');\n```\nIn the example above you access the \"food\" database, limited to the French language/country scope. \nThe first parameter is either \n - \"food\"\n - \"beauty\" or \n - \"pet\"\n \nto decide which product database you want to use.\n\nThe second parameter decides the language/country scope of the chosen database: f.e. \"world\" or \"de\" or \"fr\". \n\nFor more details on this topic: see the [API Documentation](https://en.wiki.openfoodfacts.org/API/Read#Countries_and_Language_of_the_Response)\n\nThese are all the parameters you really need for basic usage.\n\nAs return types for ```$api-\u003egetProduct``` you get an ```Document::class``` Object. \nThis may also be an Object of Type  ```FoodProduct::class```,```PetProduct::class```, ```BeautyProduct::class``` depending on which API you are creating.\nThese objects inherit from the more generic ```Document::class```\n\nIn the example above, we use the 'food' API and there will get a ```FoodProduct::class```\n\nFor getting a first overview the ```Document::class``` has a function to return an array representation(sorted) for a first start. \n```php\n$product = $api-\u003egetProduct('3057640385148');\n$productDataAsArray = $product-\u003egetData();\n```\n\n\n#### Optional Parameters\nThe other parameters are optional and for a more sophisticated use of the api (from a software development point of view):\n\nAn example in code is found here: [cached_example.php](examples/01-basic_api_usage/cached_example.php)\n\nLoggerInterface: A logger which decieds where to log errors to (file, console , etc) \n\nsee: [PSR-3 Loggerinterface](https://www.php-fig.org/psr/psr-3/)\n\nClientInterface: The HTTP Client - to adjust the connection configs to your needs and more \n\nsee: [Guzzle HTTP Client](https://packagist.org/packages/guzzlehttp/guzzle)\n\nCacheInterface: To temporarily save the results of API request to improve the performance and to reduce the load on the API- Server \n\nsee: [PSR-16 Simple Cache](https://www.php-fig.org/psr/psr-16/)\n\n## Development\n\n### Contributing\n\n1. Fork it ( https://github.com/openfoodfacts/openfoodfacts-php/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Launch test `vendor/bin/phpunit` \u0026\u0026 cs-fixer `vendor/bin/php-cs-fixer fix`\n4. Commit your changes (`git commit -am 'Add some feature'`)\n5. Push to the branch (`git push origin my-new-feature`)\n6. Create a new Pull Request\n\n## Third party applications\nIf you use this SDK, feel free to open a PR to add your application in this list.\n\n## Authors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenfoodfacts%2Fopenfoodfacts-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenfoodfacts%2Fopenfoodfacts-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenfoodfacts%2Fopenfoodfacts-php/lists"}