{"id":13579298,"url":"https://github.com/Sylius/ShopApiPlugin","last_synced_at":"2025-04-05T20:33:39.967Z","repository":{"id":19489428,"uuid":"86039336","full_name":"Sylius/ShopApiPlugin","owner":"Sylius","description":"Shop API for Sylius.","archived":false,"fork":false,"pushed_at":"2025-02-10T13:46:00.000Z","size":3837,"stargazers_count":128,"open_issues_count":51,"forks_count":90,"subscribers_count":27,"default_branch":"1.7","last_synced_at":"2025-03-07T11:19:59.144Z","etag":null,"topics":["hacktoberfest","php","symfony"],"latest_commit_sha":null,"homepage":"https://sylius.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sylius.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG-1.0.md","contributing":null,"funding":null,"license":null,"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":"2017-03-24T07:26:01.000Z","updated_at":"2025-02-11T21:33:14.000Z","dependencies_parsed_at":"2024-06-18T16:57:04.636Z","dependency_job_id":"2c7cff1a-e064-4864-bb49-9c0d925aa14f","html_url":"https://github.com/Sylius/ShopApiPlugin","commit_stats":{"total_commits":1027,"total_committers":63,"mean_commits":16.3015873015873,"dds":0.6962025316455696,"last_synced_commit":"1170f965f3f7cf1d6ef9d08816b47bcafa450f01"},"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sylius%2FShopApiPlugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sylius%2FShopApiPlugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sylius%2FShopApiPlugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sylius%2FShopApiPlugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sylius","download_url":"https://codeload.github.com/Sylius/ShopApiPlugin/tar.gz/refs/heads/1.7","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399874,"owners_count":20932876,"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":["hacktoberfest","php","symfony"],"created_at":"2024-08-01T15:01:38.164Z","updated_at":"2025-04-05T20:33:34.957Z","avatar_url":"https://github.com/Sylius.png","language":"PHP","readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://sylius.com\" target=\"_blank\"\u003e\n        \u003cpicture\u003e\n          \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://media.sylius.com/sylius-logo-800-dark.png\"\u003e\n          \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://media.sylius.com/sylius-logo-800.png\"\u003e\n          \u003cimg alt=\"Sylius Logo.\" src=\"https://media.sylius.com/sylius-logo-800.png\"\u003e\n        \u003c/picture\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eSylius Shop API \u003c/h1\u003e\n\n[![License](https://img.shields.io/packagist/l/sylius/shop-api-plugin.svg)](https://packagist.org/packages/sylius/shop-api-plugin) [![Build Status](https://travis-ci.org/Sylius/ShopApiPlugin.svg?branch=master)](https://travis-ci.org/Sylius/ShopApiPlugin) [![Scrutinizer Quality Score](https://img.shields.io/scrutinizer/g/Sylius/SyliusShopApiPlugin.svg)](https://scrutinizer-ci.com/g/Sylius/SyliusShopApiPlugin/)\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://sylius.com/plugins/\" target=\"_blank\"\u003e\u003cimg src=\"https://sylius.com/assets/badge-official-sylius-plugin.png\" width=\"200\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003eThis repository contains a plugin that extends the \u003ca href=\"https://github.com/Sylius/Sylius\"\u003eSylius eCommerce platform\u003c/a\u003e with an API in JSON that allows performing all standard shop operations from the customer perspective.\u003c/p\u003e\n\n## Documentation\n\nThe latest documentation is available [here](https://app.swaggerhub.com/apis/Sylius/sylius-shop-api/1.0.0). If you are looking for more information how the system works have a look at the [cookbook](doc/Cookbook.md)\n\n## Installation\n\n#### IMPORTANT NOTE: Before installing SyliusShopApiPlugin, you should disable all SyliusShopBundle's dependencies. You cannot use these packages together.\n\n1. Run `composer require sylius/shop-api-plugin` and, when asked if you want to execute the Flex recipe, answer 'Yes'.\n2. Extend config files:\n    1. Add SyliusShopApi to `config/bundles.php`.\n    ```php\n    // config/bundles.php\n    \n        return [\n            Sylius\\ShopApiPlugin\\SyliusShopApiPlugin::class =\u003e ['all' =\u003e true],\n        ];\n    ```\n    2. Add `- { path: '^/shop-api', priorities: ['json'], fallback_format: json, prefer_extension: true }` to `fos_rest.format_listener.rules` \n    section in `config/packages/fos_rest.yaml` file and import config from Plugin.\n    ```yml\n    # config/packages/_sylius_shop_api.yaml\n    \n    imports: # \u003c-- Add this section if it does not already exist and add the lines below\n        # ...\n        - { resource: \"@SyliusShopApiPlugin/Resources/config/app/config.yml\" }\n        - { resource: \"@SyliusShopApiPlugin/Resources/config/app/sylius_mailer.yml\" }\n\n    # config/packages/fos_rest.yaml\n    \n    fos_rest:\n        # ...\n        \n        format_listener:\n            rules:\n                - { path: '^/shop-api', priorities: ['json'], fallback_format: json, prefer_extension: true } # \u003c-- Add this\n                - { path: '^/api', priorities: ['json', 'xml'], fallback_format: json, prefer_extension: true }\n                - { path: '^/', stop: true }\n    \n    ```\n\n    3. Add new routes file to import routes from the SyliusShopApiPlugin\n    ```yml\n    # config/routes/sylius_shop_api.yaml\n\n    sylius_shop_api:\n        resource: \"@SyliusShopApiPlugin/Resources/config/routing.yml\"\n    ```\n    4. Configure firewall\n        1. Change `sylius.security.shop_regex` parameter to exclude `shop-api` prefix also\n        2. Add ShopAPI regex parameter `sylius_shop_api.security.regex: \"^/shop-api\"`\n        3. Add ShopAPI firewall config:\n            * Symfony 6:\n               ```yml\n               # config/packages/security.yaml\n        \n               parameters:\n                   # ...\n            \n                   sylius.security.shop_regex: \"^/(?!admin|api/.*|api$|shop-api|media/.*)[^/]++\" # shop-api has been added inside the brackets\n                   sylius_shop_api.security.regex: \"^/shop-api\"\n        \n               # ... \n        \n               security:\n                   firewalls:\n                       // ...\n        \n                       sylius_shop_api:\n                           pattern: \"%sylius_shop_api.security.regex%\"\n                           stateless: true\n                           entry_point: jwt\n                           provider: sylius_shop_user_provider\n                           json_login:\n                               check_path: /shop-api/login\n                               username_path: email\n                               password_path: password\n                               success_handler: lexik_jwt_authentication.handler.authentication_success\n                               failure_handler: lexik_jwt_authentication.handler.authentication_failure\n                           jwt: true\n                  access_control:\n                  - { path: \"%sylius_shop_api.security.regex%/address-book\", role: ROLE_USER}\n                  - { path: \"%sylius_shop_api.security.regex%/me\", role: ROLE_USER}\n               ```\n\n            * Symfony 5:\n               ```yml\n               # config/packages/security.yaml\n        \n               parameters:\n                   # ...\n            \n                   sylius.security.shop_regex: \"^/(?!admin|api/.*|api$|shop-api|media/.*)[^/]++\" # shop-api has been added inside the brackets\n                   sylius_shop_api.security.regex: \"^/shop-api\"\n        \n               # ... \n        \n               security:\n                   firewalls:\n                       // ...\n        \n                       sylius_shop_api:\n                           pattern: \"%sylius_shop_api.security.regex%\"\n                           stateless: true\n                           anonymous: true\n                           provider: sylius_shop_user_provider\n                           json_login:\n                               check_path: /shop-api/login\n                               username_path: email\n                               password_path: password\n                               success_handler: lexik_jwt_authentication.handler.authentication_success\n                               failure_handler: lexik_jwt_authentication.handler.authentication_failure\n                           guard:\n                               authenticators:\n                                   - lexik_jwt_authentication.jwt_token_authenticator\n                  access_control:\n                  - { path: \"%sylius_shop_api.security.regex%/address-book\", role: ROLE_USER}\n                  - { path: \"%sylius_shop_api.security.regex%/me\", role: ROLE_USER}\n               ```\n\n    5. (optional) if you have installed `nelmio/NelmioCorsBundle` for Support of Cross-Origin Ajax Request,\n        1. Add the NelmioCorsBundle to the AppKernel\n    \n        ```php\n        // config/bundles.php\n        \n        return [\n            Nelmio\\CorsBundle\\NelmioCorsBundle::class =\u003e ['all' =\u003e true],\n        ];\n\n        ```\n    \n        2. Add the new configuration file  \n    \n        ```yml\n        # config/packages/nelmio_cors.yml\n        \n        # ...\n        \n        nelmio_cors:\n            defaults:\n                allow_credentials: false\n                allow_origin: []\n                allow_headers: []\n                allow_methods: []\n                expose_headers: []\n                max_age: 0\n                hosts: []\n                origin_regex: false\n                forced_allow_origin_value: ~\n            paths:\n                '^/shop-api/':\n                    allow_origin: ['*']\n                    allow_headers: ['Content-Type', 'authorization']\n                    allow_methods: ['POST', 'PUT', 'GET', 'DELETE', 'PATCH', 'OPTIONS']\n                    max_age: 3600\n        ```\n\n3. Follow https://github.com/lexik/LexikJWTAuthenticationBundle/blob/master/Resources/doc/index.rst#installation\n\nSample configuration of Shop API can be found here: https://github.com/Sylius/SyliusDemo/commit/4872350dcd6c987d54dec1f365b4bb890d7183c9\n\n## Additional features\n\n### Attributes\n\nIf you would like to receive serialized attributes you need to define an array of theirs codes under `sylius_shop_api.included_attributes` key. E.g.\n```yml\n# config/packages/sylius_shop_api.yml\nsylius_shop_api:\n    included_attributes:\n        - \"MUG_MATERIAL_CODE\"\n```\n\nThis plugin comes with an integration with [LexikJWTAuthenticationBundle](https://github.com/lexik/LexikJWTAuthenticationBundle/). \nMore information about security customizations may be found there.\n\n## Testing\n\nThe application can be tested with API Test Case. In order to run test suite execute the following commands:\n\n```bash\n$ cp tests/Application/.env.test.dist tests/Application/.env.test\n$ set -a \u0026\u0026 source tests/Application/.env.test \u0026\u0026 set +a\n$ (cd tests/Application \u0026\u0026 bin/console doctrine:database:create -e test)\n$ (cd tests/Application \u0026\u0026 bin/console doctrine:schema:create -e test)\n\n$ vendor/bin/phpunit\n```\n\nThe application can be also tested with PHPSpec:\n\n```bash\n$ vendor/bin/phpspec run\n```\n\n## Security issues\n\nIf you think that you have found a security issue, please do not use the issue tracker and do not post it publicly. \nInstead, all security issues must be sent to `security@sylius.com`.\n\n## Maintenance\n\nThis library is officially maintained by [Sylius](https://sylius.com) together with the following contributors outside of the organization:\n * [Maximilian Pesch](https://github.com/mamazu)\n\n## Release cycle\n\nThis projects follows [Semantic Versioning](https://semver.org/). Shop API release cycle is independent from Sylius release cycle.\n\nNext major releases are not planned yet. Minor and patch releases will be published as needed.\n\nWe provide bug fixes only for the most recent minor release.\nWe provide security fixes for one year since the release of subsequent minor release.\n\n#### Supported versions\n\n| Version | Release date       | End of support     |\n|---------|--------------------|--------------------|\n| 1.0     | 23rd Nov 2019      | 19th June 2021     |\n| 1.1     | 19th June 2020     | 08th December 2020 |\n| 1.2     | 08th December 2020 | 22th April 2021    |\n| 1.2.1   | 22th April 2021    | 22th April 2021    |\n| 1.3     | 22th April 2021    | 22th April 2021    |\n| 1.3.1   | 22th April 2021    | 30th June 2021     |\n| 1.4     | 30th June 2021     | 06th July 2021     |\n| 1.4.1   | 06th July 2021     | 20th July 2022     |\n| 1.5     | 20th July 2022     | 21th July 2022     |\n| 1.5.1   | 21th July 2022     | 13th January 2023  |\n| 1.6     | 13th January 2023  |                    |\n","funding_links":[],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSylius%2FShopApiPlugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSylius%2FShopApiPlugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSylius%2FShopApiPlugin/lists"}