{"id":21571069,"url":"https://github.com/treblle/treblle-symfony","last_synced_at":"2025-10-30T17:51:11.632Z","repository":{"id":41565620,"uuid":"410871445","full_name":"Treblle/treblle-symfony","owner":"Treblle","description":"The official Treblle SDK for Symfony. Seamlessly integrate Treblle to manage communication with your dashboard, send errors, and secure sensitive data.","archived":false,"fork":false,"pushed_at":"2025-02-11T06:18:38.000Z","size":2174,"stargazers_count":7,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-20T01:41:35.579Z","etag":null,"topics":["api","api-monitoring","api-observability","backend","developer-tool","logging","php","rest-api","restful-api","sdk","sdk-php","symfony","treblle","treblle-sdk"],"latest_commit_sha":null,"homepage":"https://treblle.com","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/Treblle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-09-27T12:15:31.000Z","updated_at":"2025-02-11T06:18:20.000Z","dependencies_parsed_at":"2025-02-10T10:28:37.798Z","dependency_job_id":"1c089828-31be-4c72-b8b7-cee962e4adab","html_url":"https://github.com/Treblle/treblle-symfony","commit_stats":{"total_commits":12,"total_committers":3,"mean_commits":4.0,"dds":"0.41666666666666663","last_synced_commit":"d68b1a261712778ff2f347a6897c71a9ca279615"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle-symfony","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle-symfony/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle-symfony/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Treblle%2Ftreblle-symfony/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Treblle","download_url":"https://codeload.github.com/Treblle/treblle-symfony/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248233935,"owners_count":21069493,"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":["api","api-monitoring","api-observability","backend","developer-tool","logging","php","rest-api","restful-api","sdk","sdk-php","symfony","treblle","treblle-sdk"],"created_at":"2024-11-24T11:14:48.708Z","updated_at":"2025-10-30T17:51:11.626Z","avatar_url":"https://github.com/Treblle.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/6331a3c4-5165-4761-90a6-f462dca0edc5\"/\u003e\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n\n# Treblle\n\n\u003ca href=\"https://docs.treblle.com/en/integrations\" target=\"_blank\"\u003eIntegrations\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"http://treblle.com/\" target=\"_blank\"\u003eWebsite\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"https://docs.treblle.com\" target=\"_blank\"\u003eDocs\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"https://blog.treblle.com\" target=\"_blank\"\u003eBlog\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"https://twitter.com/treblleapi\" target=\"_blank\"\u003eTwitter\u003c/a\u003e\n\u003cspan\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\u003c/span\u003e\n\u003ca href=\"https://treblle.com/chat\" target=\"_blank\"\u003eDiscord\u003c/a\u003e\n\u003cbr /\u003e\n\n  \u003chr /\u003e\n\u003c/div\u003e\n\nAPI Intelligence Platform. 🚀\n\nTreblle is a lightweight SDK that helps Engineering and Product teams build, ship \u0026 maintain REST-based APIs faster.\n\n## Features\n\n\u003cdiv align=\"center\"\u003e\n  \u003cbr /\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/0b2cc257-6a61-48f4-9ee3-c3693fc14b31\"/\u003e\n  \u003cbr /\u003e\n  \u003cbr /\u003e\n\u003c/div\u003e\n\n- [API Monitoring \u0026 Observability](https://www.treblle.com/features/api-monitoring-observability)\n- [Auto-generated API Docs](https://www.treblle.com/features/auto-generated-api-docs)\n- [API analytics](https://www.treblle.com/features/api-analytics)\n- [Treblle API Score](https://www.treblle.com/features/api-quality-score)\n- [API Lifecycle Collaboration](https://www.treblle.com/features/api-lifecycle)\n- [Native Treblle Apps](https://www.treblle.com/features/native-apps)\n\n\n## How Treblle Works\nOnce you’ve integrated a Treblle SDK in your codebase, this SDK will send requests and response data to your Treblle Dashboard.\n\nIn your Treblle Dashboard you get to see real-time requests to your API, auto-generated API docs, API analytics like how fast the response was for an endpoint, the load size of the response, etc.\n\nTreblle also uses the requests sent to your Dashboard to calculate your API score which is a quality score that’s calculated based on the performance, quality, and security best practices for your API.\n\n\u003e Visit [https://docs.treblle.com](http://docs.treblle.com) for the complete documentation.\n\n## Security\n\n### Masking fields\nMasking fields ensure certain sensitive data are removed before being sent to Treblle.\n\nTo make sure masking is done before any data leaves your server [we built it into all our SDKs](https://docs.treblle.com/en/security/masked-fields#fields-masked-by-default).\n\nThis means data masking is super fast and happens on a programming level before the API request is sent to Treblle. You can [customize](https://docs.treblle.com/en/security/masked-fields#custom-masked-fields) exactly which fields are masked when you’re integrating the SDK.\n\n\u003e Visit the [Masked fields](https://docs.treblle.com/en/security/masked-fields) section of the [docs](https://docs.sailscasts.com) for the complete documentation.\n\n\n## Get Started\n\n1. Sign in to [Treblle](https://identity.treblle.com/login).\n2. [Create a Treblle project](https://docs.treblle.com/en/dashboard/projects#creating-a-project).\n3. [Setup the SDK](#install-the-SDK) for your platform.\n\n### Install the SDK\n\n```sh\ncomposer require treblle/treblle-symfony\n```\n\nEnable it by adding it to the list of registered bundles in `config/bundles.php`:\n\n```php\n// config/bundles.php\nreturn [\n    // ...\n    Treblle\\Symfony\\TreblleBundle::class =\u003e ['all' =\u003e true],\n];\n```\n\nConfigure the SDK by adding the following snippet to `config/packages/treblle.yaml`:\n\n```yaml\ntreblle:\n  api_key: \"%env(TREBLLE_API_KEY)%\"\n  sdk_token: \"%env(TREBLLE_SDK_TOKEN)%\"\n  debug: false\n  ignored_environments: dev,test,testing\n  masked_fields:\n    - password\n    - pwd\n    - secret\n    - password_confirmation\n    - cc\n    - card_number\n    - ccv\n    - ssn\n    - credit_score\n  excluded_headers:\n    - Authorization\n    - X-Api-Key\n```\n\n### Configuration Options\n\n- `api_key` (required): Your Treblle API key (project ID)\n- `sdk_token` (required): Your Treblle SDK token\n- `debug` (optional, default: `false`): Enable debug mode for development\n- `ignored_environments` (optional, default: `dev,test,testing`): Comma-separated list of environments to ignore\n- `masked_fields` (optional): Array of field names to mask in request/response data\n- `excluded_headers` (optional): Array of header patterns to exclude from tracking\n- `url` (optional): Custom Treblle endpoint URL for self-hosted instances\n\n### Requirements\n\n- PHP 8.2, 8.3, or 8.4\n- Symfony 6.4, 7.x, or 8.x\n- JSON extension\n\n\u003e See the [docs](https://docs.treblle.com/en/integrations/symfony) for this SDK to learn more.\n\n## Available SDKs\n\nTreblle provides [open-source SDKs](https://docs.treblle.com/en/integrations) that let you seamlessly integrate Treblle with your REST-based APIs.\n\n- [`treblle-symfony`](https://github.com/Treblle/treblle-symfony): SDK for Symfony\n- [`treblle-laravel`](https://github.com/Treblle/treblle-laravel): SDK for Laravel\n- [`treblle-php`](https://github.com/Treblle/treblle-php): SDK for PHP\n- [`treblle-lumen`](https://github.com/Treblle/treblle-lumen): SDK for Lumen\n- [`treblle-sails`](https://github.com/Treblle/treblle-sails): SDK for Sails\n- [`treblle-adonisjs`](https://github.com/Treblle/treblle-adonisjs): SDK for AdonisJS\n- [`treblle-fastify`](https://github.com/Treblle/treblle-fastify): SDK for Fastify\n- [`treblle-directus`](https://github.com/Treblle/treblle-directus): SDK for Directus\n- [`treblle-strapi`](https://github.com/Treblle/treblle-strapi): SDK for Strapi\n- [`treblle-express`](https://github.com/Treblle/treblle-express): SDK for Express\n- [`treblle-koa`](https://github.com/Treblle/treblle-koa): SDK for Koa\n- [`treblle-go`](https://github.com/Treblle/treblle-go): SDK for Go\n- [`treblle-ruby`](https://github.com/Treblle/treblle-ruby): SDK for Ruby on Rails\n- [`treblle-python`](https://github.com/Treblle/treblle-python): SDK for Python/Django\n\n\u003e See the [docs](https://docs.treblle.com/en/integrations) for more on SDKs and Integrations.\n\n## Community 💙\n\nFirst and foremost: **Star and watch this repository** to stay up-to-date.\n\nAlso, follow our [Blog](https://blog.treblle.com), and on [Twitter](https://twitter.com/treblleapi).\n\nYou can chat with the team and other members on [Discord](https://treblle.com/chat) and follow our tutorials and other video material at [YouTube](https://youtube.com/@treblle).\n\n[![Treblle Discord](https://img.shields.io/badge/Treblle%20Discord-Join%20our%20Discord-F3F5FC?labelColor=7289DA\u0026style=for-the-badge\u0026logo=discord\u0026logoColor=F3F5FC\u0026link=https://treblle.com/chat)](https://treblle.com/chat)\n\n[![Treblle YouTube](https://img.shields.io/badge/Treblle%20YouTube-Subscribe%20on%20YouTube-F3F5FC?labelColor=c4302b\u0026style=for-the-badge\u0026logo=YouTube\u0026logoColor=F3F5FC\u0026link=https://youtube.com/@treblle)](https://youtube.com/@treblle)\n\n[![Treblle on Twitter](https://img.shields.io/badge/Treblle%20on%20Twitter-Follow%20Us-F3F5FC?labelColor=1DA1F2\u0026style=for-the-badge\u0026logo=Twitter\u0026logoColor=F3F5FC\u0026link=https://twitter.com/treblleapi)](https://twitter.com/treblleapi)\n\n### How to contribute\n\nHere are some ways of contributing to making Treblle better:\n\n- **[Try out Treblle](https://docs.treblle.com/en/introduction#getting-started)**, and let us know ways to make Treblle better for you. Let us know here on [Discord](https://treblle.com/chat).\n- Join our [Discord](https://treblle.com/chat) and connect with other members to share and learn from.\n- Send a pull request to any of our [open source repositories](https://github.com/Treblle) on Github. Check the contribution guide on the repo you want to contribute to for more details about how to contribute. We're looking forward to your contribution!\n\n## Upgrading\n\n### Upgrading from v2.x to v3.0\n\nVersion 3.0 introduces **breaking changes** to align with treblle-php v5.0 naming conventions. This is a major release that requires configuration updates.\n\n#### What's New in v3.0\n\n1. **New Configuration Option: `excluded_headers`**\n   - You can now exclude specific headers from being tracked\n   - Supports exact matching, wildcards, and regex patterns\n\n2. **Support for Guzzle v9.0**\n   - The SDK now supports Guzzle HTTP client versions 7.x, 8.x, and 9.x\n\n3. **Better Integration with treblle-php**\n   - Now uses `SensitiveDataMasker` from treblle-php package\n   - Removed custom helpers in favor of treblle-php utilities\n\n4. **Updated Default Masked Fields**\n   - Removed `api_key` from default masked fields\n   - Updated to match treblle-php v5.0 defaults exactly\n\n#### Breaking Changes\n\n##### 1. Configuration Parameter Names (BREAKING)\n\nThe configuration parameter names have been updated to match treblle-php v5.0 conventions:\n\n**Before (v2.x):**\n```yaml\ntreblle:\n  project_id: \"%env(TREBLLE_PROJECT_ID)%\"\n  api_key: \"%env(TREBLLE_API_KEY)%\"\n```\n\n**After (v3.0):**\n```yaml\ntreblle:\n  api_key: \"%env(TREBLLE_API_KEY)%\"\n  sdk_token: \"%env(TREBLLE_SDK_TOKEN)%\"\n```\n\n##### 2. Environment Variable Names (BREAKING)\n\nYou need to update your environment variables:\n\n**Before (v2.x):**\n- `TREBLLE_PROJECT_ID` - Your project ID\n- `TREBLLE_API_KEY` - Your API key\n\n**After (v3.0):**\n- `TREBLLE_API_KEY` - Your project ID (this is what was TREBLLE_PROJECT_ID)\n- `TREBLLE_SDK_TOKEN` - Your SDK token (this is what was TREBLLE_API_KEY)\n\n**Important:** The *values* stay the same, only the variable names change:\n```bash\n# Before\nTREBLLE_PROJECT_ID=your-project-id\nTREBLLE_API_KEY=your-api-key\n\n# After\nTREBLLE_API_KEY=your-project-id      # Same value as old TREBLLE_PROJECT_ID\nTREBLLE_SDK_TOKEN=your-api-key       # Same value as old TREBLLE_API_KEY\n```\n\n##### 3. Default Masked Fields (BREAKING)\n\nThe field `api_key` is no longer masked by default. If you need to mask it, add it explicitly:\n\n```yaml\ntreblle:\n  masked_fields:\n    - api_key  # Add this if you need it masked\n```\n\n#### Step-by-Step Upgrade Instructions\n\n1. **Update your composer.json**\n\n   ```bash\n   composer require treblle/treblle-symfony:^3.0\n   ```\n\n2. **Update your configuration file**\n\n   Update `config/packages/treblle.yaml`:\n\n   ```yaml\n   treblle:\n     api_key: \"%env(TREBLLE_API_KEY)%\"        # Was project_id\n     sdk_token: \"%env(TREBLLE_SDK_TOKEN)%\"    # Was api_key\n     debug: false\n     ignored_environments: dev,test,testing\n     masked_fields:\n       - password\n       - pwd\n       - secret\n       - password_confirmation\n       - cc\n       - card_number\n       - ccv\n       - ssn\n       - credit_score\n     excluded_headers:  # NEW in v3.0 (optional)\n       - Authorization\n       - X-Api-Key\n   ```\n\n3. **Update your .env file**\n\n   ```bash\n   # Update variable names (keep the same values!)\n   TREBLLE_API_KEY=your-project-id        # This is your old TREBLLE_PROJECT_ID value\n   TREBLLE_SDK_TOKEN=your-api-key-token   # This is your old TREBLLE_API_KEY value\n   ```\n\n4. **Clear your cache**\n\n   ```bash\n   php bin/console cache:clear\n   ```\n\n5. **Test your application**\n\n   Verify that Treblle is tracking your API requests correctly by checking your Treblle dashboard.\n\n#### Troubleshooting\n\n**Issue: SDK not tracking requests after upgrade**\n\n**Solution:** Clear your application cache and restart your web server:\n\n```bash\nphp bin/console cache:clear\n# If using PHP-FPM\nsudo service php-fpm restart\n# If using Symfony server\nsymfony server:restart\n```\n\n**Issue: Headers still being tracked despite excluded_headers**\n\n**Solution:** Make sure the header names match exactly (case-sensitive) and clear your cache.\n\n#### Need Help?\n\nIf you encounter any issues during the upgrade:\n\n1. Check the [CHANGELOG.md](CHANGELOG.md) for detailed changes\n2. Review the configuration examples above\n3. Open an issue on [GitHub](https://github.com/Treblle/treblle-symfony/issues)\n4. Join our [Discord community](https://treblle.com/chat)\n\n#### Rollback Instructions\n\nIf you need to rollback to v2.x:\n\n```bash\ncomposer require treblle/treblle-symfony:^2.0\nphp bin/console cache:clear\n```\n\nNote that v2.x configuration will continue to work in v3.0, so you can upgrade without immediately changing your config files.\n\n### Contributors\n\u003c!-- Replace link with the link of the SDK contributors--\u003e\n\u003ca href=\"https://github.com/Treblle/treblle-symfony/graphs/contributors\"\u003e\n  \u003cp align=\"center\"\u003e\n    \u003cimg  src=\"https://contrib.rocks/image?repo=Treblle/treblle-symfony\" alt=\"A table of avatars from the project's contributors\" /\u003e\n  \u003c/p\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreblle%2Ftreblle-symfony","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftreblle%2Ftreblle-symfony","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreblle%2Ftreblle-symfony/lists"}