{"id":20508936,"url":"https://github.com/akeneo/api-php-client","last_synced_at":"2025-05-15T07:05:40.663Z","repository":{"id":37587898,"uuid":"88267141","full_name":"akeneo/api-php-client","owner":"akeneo","description":"PHP client of Akeneo PIM API","archived":false,"fork":false,"pushed_at":"2024-11-07T15:49:25.000Z","size":1210,"stargazers_count":93,"open_issues_count":19,"forks_count":61,"subscribers_count":36,"default_branch":"master","last_synced_at":"2025-04-29T18:12:50.623Z","etag":null,"topics":["akeneo","api","api-client","php","php-client","pim","rest"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/akeneo/api-php-client","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akeneo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-14T12:48:43.000Z","updated_at":"2025-03-26T09:46:01.000Z","dependencies_parsed_at":"2024-06-18T12:16:25.720Z","dependency_job_id":"775a6c97-ea12-45a8-97c1-f1972da8c8a3","html_url":"https://github.com/akeneo/api-php-client","commit_stats":{"total_commits":289,"total_committers":33,"mean_commits":8.757575757575758,"dds":0.7231833910034602,"last_synced_commit":"58565f94e752e659c19002f0e4702955aeaf5476"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akeneo%2Fapi-php-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akeneo%2Fapi-php-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akeneo%2Fapi-php-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akeneo%2Fapi-php-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akeneo","download_url":"https://codeload.github.com/akeneo/api-php-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251812750,"owners_count":21647960,"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":["akeneo","api","api-client","php","php-client","pim","rest"],"created_at":"2024-11-15T20:21:18.337Z","updated_at":"2025-05-15T07:05:35.650Z","avatar_url":"https://github.com/akeneo.png","language":"PHP","readme":"# PHP Akeneo PIM API\n\nA simple PHP client to use the [Akeneo PIM API](https://api.akeneo.com/).\n\nMatrix compatibility:\n\n| PIM version(s) | API PHP Client version | CI status                                                                                                                                         |\n|----------------|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|\n| v2.0           | v1.0                   | [![Build Status](https://travis-ci.org/akeneo/api-php-client.svg?branch=1.0)](https://travis-ci.org/akeneo/api-php-client)                        |\n| v2.1 - v2.2    | v2.0                   | [![Build Status](https://travis-ci.org/akeneo/api-php-client.svg?branch=2.0)](https://travis-ci.org/akeneo/api-php-client)                        |\n| v2.3           | v3.0                   | [![Build Status](https://travis-ci.org/akeneo/api-php-client.svg?branch=3.0)](https://travis-ci.org/akeneo/api-php-client)                        |\n| v3.0 - v4.0    | v4.0 - v5.0            | [![Build Status](https://travis-ci.org/akeneo/api-php-client.svg?branch=4.0)](https://travis-ci.org/akeneo/api-php-client)                        |\n| v5.0           | v6.0                   | -                                                                                                                                                 |\n| v6.0           | \u003e= v7.0                | -                                                                                                                                                 |\n| -              | master                 | [![CircleCI](https://circleci.com/gh/akeneo/api-php-client/tree/master.svg?style=svg)](https://circleci.com/gh/akeneo/api-php-client/tree/master) |\n\nNote that our PHP client is backward compatible.\nFor example, if your PIM is currently a v2.3, you can still use a 1.0 version of the PHP client. The new endpoints available in v2.3 will not be available in the v1.0 of the PHP client.\n\n## Requirements\n\n* PHP \u003e= 8.2\n* Composer \n\n## Installation\n\nWe use HTTPPlug as the HTTP client abstraction layer.\nIn this example, we will use [Guzzle](https://github.com/guzzle/guzzle) v6 as the HTTP client implementation.\n\n`api-php-client` uses [Composer](http://getcomposer.org).\nThe first step to use `api-php-client` is to download composer:\n\n```bash\n$ curl -s http://getcomposer.org/installer | php\n```\n\nThen, run the following command to require the library:\n```bash\n$ php composer.phar require akeneo/api-php-client php-http/guzzle7-adapter:^1.0 http-interop/http-factory-guzzle:^1.0\n```\n\nIf you want to use another HTTP client implementation, you can check [here](https://packagist.org/providers/php-http/client-implementation) the full list of HTTP client implementations. \n\n## Documentation\n\nFull documentation is available on the [API website](https://api.akeneo.com/php-client/introduction.html).\n\n## Getting started\n\n### Initialise the client\nYou first need to initialise the client with your credentials client id/secret and with your user/password.\n\nIf you don't have any client id, let's take a look at [this page](https://api.akeneo.com/documentation/authentication.html) to create it.\n\n```php\n\u003c?php\n\nrequire_once __DIR__ . '/vendor/autoload.php';\n\n$clientBuilder = new \\Akeneo\\Pim\\ApiClient\\AkeneoPimClientBuilder('http://localhost/');\n$client = $clientBuilder-\u003ebuildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');\n```\n\nYou can authenticate to the client with your token/refresh token as well.\n```php\n$client = $clientBuilder-\u003ebuildAuthenticatedByToken('client_id', 'secret', 'token', 'refresh_token');\n```\n\nGetting the token and refresh token is as simple as:\n```php\n$client-\u003egetToken();\n$client-\u003egetRefreshToken();\n```\n\nIf you are developing an App, authenticate with your app token.\n```php\n$client = $clientBuilder-\u003ebuildAuthenticatedByAppToken('app_token');\n```\n\n### Get a product\n\n```php\n$product = $client-\u003egetProductApi()-\u003eget('top');\necho $product['identifier']; // display \"top\"\n```\n\n### Get a list of products\n\n#### By getting pages\n\n```php\n$searchBuilder = new \\Akeneo\\Pim\\ApiClient\\Search\\SearchBuilder();\n$searchBuilder-\u003eaddFilter('enabled', '=', true);\n$searchFilters = $searchBuilder-\u003egetFilters();\n\n$firstPage = $client-\u003egetProductApi()-\u003elistPerPage(50, true, ['search' =\u003e $searchFilters]);\n\necho $firstPage-\u003egetCount();\n\nforeach ($firstPage-\u003egetItems() as $product) {\n    // do your stuff here\n    echo $product['identifier'];\n}\n\n$nextPage = $firstPage-\u003egetNextPage();\n\n$firstPage = $nextPage-\u003egetPreviousPage();\n```\n\n#### By getting a cursor \n\n```php\n$searchBuilder = new \\Akeneo\\Pim\\ApiClient\\Search\\SearchBuilder();\n$searchBuilder-\u003eaddFilter('enabled', '=', true);\n$searchFilters = $searchBuilder-\u003egetFilters();\n\n$products = $client-\u003egetProductApi()-\u003eall(50, ['search' =\u003e $searchFilters]);\nforeach ($products as $product) {\n    // do your stuff here\n    echo $product['identifier'];\n}\n```\n\n### Create a product\n\n```php\n$client-\u003egetProductApi()-\u003ecreate('top', ['enabled' =\u003e true]);\n```\n\n### Upsert a product\n\n```php\n$client-\u003egetProductApi()-\u003eupsert('top', ['family' =\u003e 'tshirt']);\n```\n\n### Upsert a list of of products\n\n```php\n$client-\u003egetProductApi()-\u003eupsertList([\n    [\n        'identifier' =\u003e 'top',\n        'family' =\u003e 'tshirt',\n    ],\n    [\n        'identifier' =\u003e 'cap',\n        'categories' =\u003e ['hat'],\n    ],\n]);\n```\n\n### Headers option\n\nYou can make the client send requests with additional headers. Default client headers can be overriden.\n\n```php\n$clientBuilder = new \\Akeneo\\Pim\\ApiClient\\AkeneoPimClientBuilder(\n    'http://localhost',\n    ['headers' =\u003e ['X-HEADER-NAME' =\u003e 'content']]\n);\n$client = $clientBuilder-\u003ebuildAuthenticatedByToken('token');\n```\n\n## Testing\n\nDo note that you have to delete the `composer.lock` because Doctrine dependencies are loaded.\nThese dependencies are different in function of the PHP version running `composer install`.\n\n``` bash\n# Build the project\nmake dependencies\n\n# Run PHPUnit tests\nmake unit\n\n# Run PHPSpec tests\nmake spec\n\n# Run code style check\nmake cs\n\n# ... or directly run all tests\nmake tests\n```\n\n## Support\n\nThe support of this client is made in best effort by our Akeneo team.\n\nIf you find a bug or want to submit an improvement, don't hesitate to raise an issue on Github.\nAlso, you can ask questions and discuss about the PHP client with the community in the [Slack User Group](https://akeneopim-ug.slack.com/messages/web-api/).\n\n## Contributing\n\nAs this PHP client is an open-source project, all contributions are very welcome!\n\nFor more information, please consult [the contributing section](CONTRIBUTING.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakeneo%2Fapi-php-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakeneo%2Fapi-php-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakeneo%2Fapi-php-client/lists"}