{"id":20195085,"url":"https://github.com/newrelic-experimental/newrelic-commercetools-integration-php","last_synced_at":"2026-06-05T06:31:19.587Z","repository":{"id":198491110,"uuid":"700887385","full_name":"newrelic-experimental/newrelic-commercetools-integration-php","owner":"newrelic-experimental","description":"New Relic CommerceTools Integration PHP. Uses CommerceTools PHP SDK and New Relic PHP Agent","archived":false,"fork":false,"pushed_at":"2024-12-03T02:12:40.000Z","size":255,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-12-01T05:54:20.100Z","etag":null,"topics":["commercetools","commercetools-sdk","emeafet","newrelic","nrlabs","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/newrelic-experimental.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-05T13:44:35.000Z","updated_at":"2023-10-16T15:47:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"6f6c0862-374c-49fe-b999-de360484af03","html_url":"https://github.com/newrelic-experimental/newrelic-commercetools-integration-php","commit_stats":null,"previous_names":["matewilk/newrelic-commercetools-php-integration","matewilk/newrelic-commercetools-integration-php"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/newrelic-experimental/newrelic-commercetools-integration-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic-experimental%2Fnewrelic-commercetools-integration-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic-experimental%2Fnewrelic-commercetools-integration-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic-experimental%2Fnewrelic-commercetools-integration-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic-experimental%2Fnewrelic-commercetools-integration-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/newrelic-experimental","download_url":"https://codeload.github.com/newrelic-experimental/newrelic-commercetools-integration-php/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic-experimental%2Fnewrelic-commercetools-integration-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33932048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-05T02:00:06.157Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["commercetools","commercetools-sdk","emeafet","newrelic","nrlabs","php"],"created_at":"2024-11-14T04:15:42.399Z","updated_at":"2026-06-05T06:31:19.569Z","avatar_url":"https://github.com/newrelic-experimental.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://opensource.newrelic.com/oss-category/#new-relic-experimental\"\u003e\u003cpicture\u003e\u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/newrelic/opensource-website/raw/main/src/images/categories/dark/Experimental.png\"\u003e\u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Experimental.png\"\u003e\u003cimg alt=\"New Relic Open Source experimental project banner.\" src=\"https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Experimental.png\"\u003e\u003c/picture\u003e\u003c/a\u003e\n\n# New Relic CommerceTools Integration PHP\n\nThis Demo is to show how PHP CommerceTools SDK can be used in a PHP (Symfony) application (in a Docker environment) with NewRelic monitoring enabled.\n\n## Requirements\n\n- PHP at least 8.1\n- Symfony 6 \n- Docker\n- New Relic license key\n- CommerceTools client credentials (id and secret)\n\n## Installation\n\n1. Clone/Download the repository.\n2. Navigate to the path `root` directory.\n3. Register the client credentials in environment variables `.env` file\n```\nAPP_CTP_CLIENT_ID= your CTP_CLIENT_ID\nAPP_CTP_CLIENT_SECRET= your CTP_CLIENT_SECRET\nAPP_CTP_PROJECT_KEY= your CTP_PROJECT_KEY\nAPP_CTP_REGION=your CTP_CLOUD_REGION\n```\n1. Along with New Relic license key in the same file `.env` file\n```\nNEWRELIC_KEY=your New Relic license key\nNEWRELIC_APP_NAME=newrelic-commercetools-php-integration\n```\n\nSee the `env.example` file for reference.\n\n## Architecture\n### Containers\nThe app consists of 3 containers:\n- `nginx` - nginx web server\n- `php` - php-fpm container with the Symfony app\n- `test` - container with the test script\n\n### Endpoints\nThe app has 6 endpoints:\n- `/` - healthcheck endpoint\n- `/products` - endpoint to get products from CommerceTools\n- `/categories` - endpoint to get categories from CommerceTools\n- `/inventroy` - endpoint to get inventory from CommerceTools\n- `/orders` - endpoint to get orders from CommerceTools\n\n\nThe application's architecture simplified diagram is shown below:\n\u003cimg width=\"886\" alt=\"app_diagram\" src=\"https://github.com/matewilk/newrelic-commercetools-php-integration/assets/6328360/b6e4cfa1-ae09-448d-85d7-0fd919fe2ccd\"\u003e\n\nNew Relic monitoring is enabled for the `php` container. The `nginx` container is not monitored. The `test` container is used to run the test script. \n\nNew Relinc PHP Agent is installed in the `php` container. The agent is configured in the `newrelic.ini` file located in the `docker/php` directory.\n\nNew Relic hooks up to CommerceTools SDK via Guzzle HTTP client which is used internally by the SDK and monitored by the New Relic agent by default.\n\n### Monitoring\nNew Relic will monitor the following:\n- All application performance metrics\n- PHP application errors\n- PHP application transactions\n- Calls to CommerceTools API (external services) via the PHP SDK (Guzzle HTTP client)\n- and more\n\n## Test script (optional for local testing)\n\nUncomment the following lines in the `docker-compose.yml` file to run the test script in a separate container\n```yaml\n        # test:\n        #   build:\n        #     context: .\n        #     dockerfile: docker/test/Dockerfile\n        #   command: [\"./test_script.sh\"]\n        #   depends_on:\n        #     nginx:\n        #       condition: service_healthy\n```\nThis will run the `test_script.sh` script in the `test` container. The script will make a request to the various endpoint in order to visualise the New Relic monitoring.\n\n## Using the Symfony Demo app in a Docker Environment\n\n### Configuring the Demo App\n\n1. Open the Terminal\n2. Run `composer dump-env prod`\n3. Run `composer install` or `composer update`\n\n### Preparing the Docker environment\n\n1. Always in the Root of the project \n2. For apple silicon hosted builds uncomment `platform: linux/amd64` in the `docker-compose.yml` file\n3. Run `docker compose up`\n4. Wait until the environment is running\n\n### Navigate the application (or use the test script mentioned above)\n\n1. Navigate to [http://localhost:8080/products](http://localhost:8080/products), [http://localhost:8080/categories](http://localhost:8080/categories), [http://localhost:8080/inventory](http://localhost:8080/inventory) or [http://localhost:8080/orders](http://localhost:8080/orders)\n2. The result would be an array objects containing results from CommerceTools API.\n3. If it's not please make sure that in Merchant Center in the project key selected (see the environment variable for the client credentials in the point 3 of the Installation section), there would be some data for products and categories.\n4. Go in the New Relic UI to see the monitoring of the API calls.\n\n\n### Screen shots from New Relic UI\n\u003cimg width=\"1882\" alt=\"Screenshot 2023-10-05 at 15 06 56\" src=\"https://github.com/matewilk/newrelic-commercetools-php-integration/assets/6328360/f01eff22-aee2-4c69-b232-940b303f1e7d\"\u003e\n\u003cimg width=\"1913\" alt=\"Screenshot 2023-10-05 at 15 08 01\" src=\"https://github.com/matewilk/newrelic-commercetools-php-integration/assets/6328360/7e2a1f1f-b5d1-4353-82ce-e72e685ebe9a\"\u003e\n\u003cimg width=\"1879\" alt=\"Screenshot 2023-10-05 at 15 08 44\" src=\"https://github.com/matewilk/newrelic-commercetools-php-integration/assets/6328360/580e1dd2-4534-4625-a969-40297bd50aa8\"\u003e\n\u003cimg width=\"1876\" alt=\"Screenshot 2023-10-05 at 15 09 07\" src=\"https://github.com/matewilk/newrelic-commercetools-php-integration/assets/6328360/61337915-dd7a-4989-a504-c5b83b47e6fe\"\u003e\n\u003cimg width=\"1878\" alt=\"Screenshot 2023-10-05 at 15 09 37\" src=\"https://github.com/matewilk/newrelic-commercetools-php-integration/assets/6328360/cbffa445-5741-4993-9527-24299958a463\"\u003e\n\u003cimg width=\"1883\" alt=\"Screenshot 2023-10-05 at 15 10 21\" src=\"https://github.com/matewilk/newrelic-commercetools-php-integration/assets/6328360/ee0d021b-1eab-4d92-9ba7-643b37c43a38\"\u003e\n\u003cimg width=\"1893\" alt=\"Screenshot 2023-10-05 at 15 11 48\" src=\"https://github.com/matewilk/newrelic-commercetools-php-integration/assets/6328360/431db20e-151c-48c1-a11b-a97551f2c742\"\u003e\n\u003cimg width=\"1875\" alt=\"Screenshot 2023-10-05 at 15 12 34\" src=\"https://github.com/matewilk/newrelic-commercetools-php-integration/assets/6328360/5ad45841-132b-4d21-8295-3a46a3abc846\"\u003e\n\n## Support\n\nNew Relic hosts and moderates an online forum where customers can interact with New Relic employees as well as other customers to get help and share best practices.\n\n## Contributing\nWe encourage your contributions to improve [project name]! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.\nIf you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company,  please drop us an email at opensource@newrelic.com.\n\n**A note about vulnerabilities**\n\nAs noted in our [security policy](https://github.com/newrelic-experimental/newrelic-commercetools-integration-php/security/policy), New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.\n\nIf you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through [HackerOne](https://hackerone.com/newrelic).\n\n## License\nNew Relic CommerceTools Integration PHP is licensed under the [Apache 2.0](http://apache.org/licenses/LICENSE-2.0.txt) License.\n\u003e[If applicable: The [project name] also uses source code from third-party libraries. You can find full details on which libraries are used and the terms under which they are licensed in the third-party notices document.]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewrelic-experimental%2Fnewrelic-commercetools-integration-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnewrelic-experimental%2Fnewrelic-commercetools-integration-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewrelic-experimental%2Fnewrelic-commercetools-integration-php/lists"}