{"id":18696192,"url":"https://github.com/apitoolkit/apitoolkit-slim","last_synced_at":"2025-04-12T07:30:54.849Z","repository":{"id":211769962,"uuid":"729803806","full_name":"apitoolkit/apitoolkit-slim","owner":"apitoolkit","description":"APItoolkit's Slim (PHP) client SDK.","archived":false,"fork":false,"pushed_at":"2025-01-06T18:08:26.000Z","size":196,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-09T11:01:59.010Z","etag":null,"topics":["apitoolkit","apitoolkit-sdk","php","slim-framework"],"latest_commit_sha":null,"homepage":"https://apitoolkit.io/docs/sdks/php/slim","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/apitoolkit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2023-12-10T12:13:44.000Z","updated_at":"2025-01-06T18:08:30.000Z","dependencies_parsed_at":"2023-12-19T14:32:32.568Z","dependency_job_id":"3615edbf-6d84-4bf7-8300-6c64e74f060c","html_url":"https://github.com/apitoolkit/apitoolkit-slim","commit_stats":null,"previous_names":["apitoolkit/apitoolkit-slim"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apitoolkit%2Fapitoolkit-slim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apitoolkit%2Fapitoolkit-slim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apitoolkit%2Fapitoolkit-slim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apitoolkit%2Fapitoolkit-slim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apitoolkit","download_url":"https://codeload.github.com/apitoolkit/apitoolkit-slim/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248533579,"owners_count":21120121,"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":["apitoolkit","apitoolkit-sdk","php","slim-framework"],"created_at":"2024-11-07T11:17:28.749Z","updated_at":"2025-04-12T07:30:54.840Z","avatar_url":"https://github.com/apitoolkit.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n![APItoolkit's Logo](https://github.com/apitoolkit/.github/blob/main/images/logo-white.svg?raw=true#gh-dark-mode-only)\n![APItoolkit's Logo](https://github.com/apitoolkit/.github/blob/main/images/logo-black.svg?raw=true#gh-light-mode-only)\n\n## Slim SDK\n\n[![APItoolkit SDK](https://img.shields.io/badge/APItoolkit-SDK-0068ff?logo=php)](https://github.com/topics/apitoolkit-sdk) [![Join Discord Server](https://img.shields.io/badge/Chat-Discord-7289da)](https://apitoolkit.io/discord?utm_campaign=devrel\u0026utm_medium=github\u0026utm_source=sdks_readme) [![APItoolkit Docs](https://img.shields.io/badge/Read-Docs-0068ff)](https://apitoolkit.io/docs/sdks/php/slim?utm_campaign=devrel\u0026utm_medium=github\u0026utm_source=sdks_readme)\n\nAPItoolkit is an end-to-end API and web services management toolkit for engineers and customer support teams. To integrate your Slim (PHP) application with APItoolkit, you need to use this SDK to monitor incoming traffic, aggregate the requests, and then deliver them to the APItoolkit's servers.\n\n\u003c/div\u003e\n\n---\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Open Telemetry Configuration](#setup-opentelemetry)\n- [APItoolkit Middleware Setup](#setup-apitoolkit-middleware)\n- [Contributing and Help](#contributing-and-help)\n- [License](#license)\n\n---\n\n## Installation\n\nKindly run the command below to install the apitoolkit-slim sdk and otel packages:\n\n```sh\ncomposer require \\\n    open-telemetry/sdk \\\n    open-telemetry/exporter-otlp \\\n    open-telemetry/opentelemetry-auto-slim \\\n    open-telemetry/opentelemetry-auto-psr18 \\\n    apitoolkit/apitoolkit-slim\n\n```\n\n## Setup Opentelemetry\n\n#### Installing opentelemetry extension\n\nAfter installing the necessary packages, you'll need to install the opentelemetry extention and add it to your `php.ini` file\n\n```sh\npecl install opentelemetry\n```\n\nThen add it to your `php.ini` file like so.\n\n```ini\n[opentelemetry]\nextension=opentelemetry.so\n```\n\nExport the following environment variables to configure the opentelemetry extension.\n\n```sh\nexport OTEL_PHP_AUTOLOAD_ENABLED=true\nexport OTEL_SERVICE_NAME=your-service-name\nexport OTEL_TRACES_EXPORTER=otlp\nexport OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf\nexport OTEL_EXPORTER_OTLP_ENDPOINT=http://otelcol.apitoolkit.io:4318\nexport OTEL_RESOURCE_ATTRIBUTES=\"at-project-key={ENTER_YOUR_API_KEY_HERE}\"\nexport OTEL_PROPAGATORS=baggage,tracecontext\n```\n\n## Setup APItoolkit Middleware\n\nNext, create a new instance of the `APIToolkitMiddleware` class and register the middleware with the Slim Framework in the `app/middleware.php` file. This creates a customs spans which captures and sends http request info such as headers, requests and repsonse bodies, matched route etc. for each request\n\n```php\nuse Slim\\Factory\\AppFactory;\nuse APIToolkit\\APIToolkitMiddleware;\n\nrequire __DIR__ . '/vendor/autoload.php';\n\n$app = AppFactory::create();\n\n$apitoolkitMiddleware = new APIToolkitMiddleware(['captureRequestBody' =\u003e true]);\n\n$app-\u003eadd($apitoolkitMiddleware);\n\n$app-\u003eget('/', function ($request, $response) {\n    $response-\u003egetBody()-\u003ewrite('Hello, World!');\n    return $response;\n});\n\n$app-\u003erun();\n```\n\n\u003e [!NOTE]\n\u003e\n\u003e The `{ENTER_YOUR_API_KEY_HERE}` demo string should be replaced with the [API key](https://apitoolkit.io/docs/dashboard/settings-pages/api-keys?utm_campaign=devrel\u0026utm_medium=github\u0026utm_source=sdks_readme) generated from the APItoolkit dashboard.\n\n\u003cbr /\u003e\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e To learn more configuration options (redacting fields, error reporting, outgoing requests, etc.), please read this [SDK documentation](https://apitoolkit.io/docs/sdks/php/slim?utm_campaign=devrel\u0026utm_medium=github\u0026utm_source=sdks_readme).\n\n## Contributing and Help\n\nTo contribute to the development of this SDK or request help from the community and our team, kindly do any of the following:\n\n- Read our [Contributors Guide](https://github.com/apitoolkit/.github/blob/main/CONTRIBUTING.md).\n- Join our community [Discord Server](https://apitoolkit.io/discord?utm_campaign=devrel\u0026utm_medium=github\u0026utm_source=sdks_readme).\n- Create a [new issue](https://github.com/apitoolkit/apitoolkit-slim/issues/new/choose) in this repository.\n\n## License\n\nThis repository is published under the [MIT](LICENSE) license.\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n\u003ca href=\"https://apitoolkit.io?utm_campaign=devrel\u0026utm_medium=github\u0026utm_source=sdks_readme\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003cimg src=\"https://github.com/apitoolkit/.github/blob/main/images/icon.png?raw=true\" width=\"40\" /\u003e\u003c/a\u003e\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapitoolkit%2Fapitoolkit-slim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapitoolkit%2Fapitoolkit-slim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapitoolkit%2Fapitoolkit-slim/lists"}