{"id":30177591,"url":"https://github.com/excimetry/excimetry","last_synced_at":"2025-08-12T05:00:26.995Z","repository":{"id":303233264,"uuid":"1014797855","full_name":"excimetry/excimetry","owner":"excimetry","description":"Excimetry is a PHP profiling library that provides a bridge between the ext-excimer extension and various profiling tools and platforms. ","archived":false,"fork":false,"pushed_at":"2025-08-01T09:43:32.000Z","size":1082,"stargazers_count":52,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-01T11:51:50.268Z","etag":null,"topics":["excimer","opentelemetry","profiling","pyroscope"],"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/excimetry.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,"zenodo":null}},"created_at":"2025-07-06T12:44:40.000Z","updated_at":"2025-08-01T09:53:33.000Z","dependencies_parsed_at":"2025-08-01T11:15:10.077Z","dependency_job_id":"e6026c73-ef16-412d-969b-9c5a3920156d","html_url":"https://github.com/excimetry/excimetry","commit_stats":null,"previous_names":["excimetry/excimetry"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/excimetry/excimetry","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/excimetry%2Fexcimetry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/excimetry%2Fexcimetry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/excimetry%2Fexcimetry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/excimetry%2Fexcimetry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/excimetry","download_url":"https://codeload.github.com/excimetry/excimetry/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/excimetry%2Fexcimetry/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270005547,"owners_count":24510933,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"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":["excimer","opentelemetry","profiling","pyroscope"],"created_at":"2025-08-12T05:00:26.076Z","updated_at":"2025-08-12T05:00:26.956Z","avatar_url":"https://github.com/excimetry.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![logo](https://raw.githubusercontent.com/excimetry/excimetry/refs/heads/main/static/logo.jpg)\n\n# Excimetry\n\nExcimetry is a PHP profiling library that provides a bridge between the [ext-excimer](https://www.mediawiki.org/wiki/Excimer) extension and various profiling tools and platforms. It offers a simple and flexible way to profile PHP applications and export the results to various formats and backends.\n\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/excimetry/excimetry/actions\"\u003e\u003cimg src=\"https://github.com/excimetry/excimetry/actions/workflows/tests.yml/badge.svg\" alt=\"Tests status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/excimetry/excimetry\"\u003e\u003cimg src=\"https://img.shields.io/packagist/v/excimetry/excimetry.svg\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/excimetry/excimetry\"\u003e\u003cimg src=\"https://img.shields.io/packagist/l/excimetry/excimetry.svg\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n## Features\n\n- **Simple Configuration**: Easy setup with sensible defaults\n- **Flexible Profiling**: Control when and how profiling happens\n- **Multiple Export Formats**:\n  - Collapsed format (for flamegraph tools)\n  - [Speedscope JSON](https://www.speedscope.app/) (for interactive flame graphs)\n  - OpenTelemetry OTLP (for integration with observability platforms)\n- **Multiple Backends**:\n  - Local file storage\n  - HTTP/GRPC export to OpenTelemetry Collector\n  - Pyroscope integration\n- **OpenTelemetry Integration**: Connect profiles with traces and metrics\n- **Command-line Tools**: Profile PHP scripts from the command line\n\n## Requirements\n\n- PHP 8.2 or higher\n- [ext-excimer](https://www.mediawiki.org/wiki/Excimer) extension\n\n## Installation\n\n### Installing the ext-excimer Extension\n\nBefore installing Excimetry, you need to install the ext-excimer extension. Here's how to do it:\n\n#### Using PECL\n\n```bash\npecl install excimer\n```\n\nThen add the following line to your php.ini file:\n\n```ini\nextension=excimer.so\n```\n\n#### From Source\n\n```bash\ngit clone https://github.com/wikimedia/php-excimer.git\ncd php-excimer\nphpize\n./configure\nmake\nmake install\n```\n\nThen add the following line to your php.ini file:\n\n```ini\nextension=excimer.so\n```\n\n### Installing Excimetry\n\nOnce you have the ext-excimer extension installed, you can install Excimetry using Composer:\n\n```bash\ncomposer require excimetry/excimetry\n```\n\nTo use the command-line tool globally:\n\n```bash\ncomposer global require excimetry/excimetry\n```\n\n## Basic Usage\n\nHere's a simple example of how to use Excimetry to profile a PHP application:\n\n```php\nuse Excimetry\\Profiler\\ExcimerProfiler;\nuse Excimetry\\Exporter\\SpeedscopeExporter;\nuse Excimetry\\Backend\\FileBackend;\n\n// Create a profiler with custom options\n$profiler = new ExcimerProfiler([\n    'period' =\u003e 0.01, // 10ms sampling period\n    'mode' =\u003e 'wall',  // Wall time profiling (also supports 'cpu')\n]);\n\n// Start profiling\n$profiler-\u003estart();\n\n// Your code to profile here\n// ...\n\n// Stop profiling\n$profiler-\u003estop();\n\n// Get the profile\n$log = $profiler-\u003egetLog();\n\n// Export to speedscope format and save to a file\n$exporter = new SpeedscopeExporter('My Profile');\n$backend = new FileBackend($exporter, 'profiles');\n$backend-\u003esend($log);\n```\n\n## Speedscope Export\n\n[Speedscope](https://www.speedscope.app/) is an interactive flamegraph visualization tool that works in the browser. Excimetry can export profiles in the Speedscope JSON format, which can then be loaded into the Speedscope web app.\n\n```php\nuse Excimetry\\Profiler\\ExcimerProfiler;\nuse Excimetry\\Exporter\\SpeedscopeExporter;\nuse Excimetry\\Backend\\FileBackend;\n\n// Create a profiler\n$profiler = new ExcimerProfiler();\n\n// Start profiling\n$profiler-\u003estart();\n\n// Your code to profile here\n// ...\n\n// Stop profiling\n$profiler-\u003estop();\n\n// Get the profile\n$log = $profiler-\u003egetLog();\n\n// Export to speedscope format with a custom profile name\n$exporter = new SpeedscopeExporter('My Custom Profile');\n$backend = new FileBackend($exporter, 'profiles');\n\n// Send the profile to the backend\n$backend-\u003esend($log);\n\n// The profile will be saved to a file in the 'profiles' directory\n// You can then load this file into https://www.speedscope.app/\n```\n\n## Command-line Profiling\n\nExcimetry includes a command-line tool for profiling PHP scripts. This is useful for profiling scripts that run from the command line, such as cron jobs or CLI applications.\n\n```bash\n# Basic usage\nexcimetry-profile path/to/script.php\n\n# With custom options\nexcimetry-profile --period=0.01 --mode=wall --format=speedscope --output=profiles path/to/script.php\n\n# Pass arguments to the script\nexcimetry-profile path/to/script.php arg1 arg2 arg3\n```\n\nOptions:\n- `--period=\u003cseconds\u003e`: Sampling period in seconds (default: 0.01)\n- `--mode=\u003cmode\u003e`: Profiling mode: wall or cpu (default: wall)\n- `--format=\u003cformat\u003e`: Output format: speedscope or collapsed (default: speedscope)\n- `--output=\u003cdir\u003e`: Output directory (default: profiles)\n- `--help`: Display help message\n\n## OpenTelemetry Integration\n\n[OpenTelemetry](https://opentelemetry.io/) is an observability framework for cloud-native software. Excimetry can send profiles to an OpenTelemetry Collector, which can then forward them to various backends.\n\n```php\nuse Excimetry\\OpenTelemetry\\OpenTelemetryIntegration;\n\n// Create an integration with the OpenTelemetry Collector\n$integration = OpenTelemetryIntegration::create(\n    'http://localhost:4318', // OpenTelemetry Collector URL\n    'my-service'             // Service name\n);\n\n// Start profiling\n$integration-\u003estart();\n\n// Your code to profile here\n// ...\n\n// Stop profiling and send to OpenTelemetry\n$integration-\u003estop();\n\n// You can also add trace and span IDs to connect profiles with traces\n$integration-\u003eaddTraceId('trace-id');\n$integration-\u003eaddSpanId('span-id');\n\n// Add custom metadata\n$integration-\u003eaddMetadata('version', '1.0.0');\n$integration-\u003eaddMetadata('environment', 'production');\n\n// Access the underlying profiler and backend\n$profiler = $integration-\u003egetProfiler();\n$backend = $integration-\u003egetBackend();\n```\n\n## Pyroscope Integration\n\n[Pyroscope](https://pyroscope.io/) is a continuous profiling platform that helps you find performance issues in your code. Excimetry can send profiles directly to a Pyroscope server.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/excimetry/excimetry/refs/heads/main/static/pyroscope-symfony-example.png\" style=\"width: 70%;\"\u003e\n\u003c/p\u003e\n\n```php\nuse Excimetry\\Profiler\\ExcimerProfiler;\nuse Excimetry\\Exporter\\CollapsedExporter;\nuse Excimetry\\Backend\\PyroscopeBackend;\n\n// Create a profiler\n$profiler = new ExcimerProfiler();\n\n// Start profiling\n$profiler-\u003estart();\n\n// Your code to profile here\n// ...\n\n// Stop profiling\n$profiler-\u003estop();\n\n// Get the profile\n$log = $profiler-\u003egetLog();\n\n// Send to Pyroscope\n$exporter = new CollapsedExporter();\n$backend = new PyroscopeBackend(\n    serverUrl: 'http://localhost:4040',\n    appName: 'my-application',\n    labels: ['env' =\u003e 'production'],\n    exporter: $exporter,\n);\n\n// Send the profile to Pyroscope\n$backend-\u003esend($log);\n\n// You can also set the backend to send asynchronously\n$backend-\u003esetAsync(true);\n$backend-\u003esend($log); // Returns immediately, sends in background\n\n// Add custom labels\n$backend-\u003eaddLabel('version', '1.0.0');\n$backend-\u003eaddLabel('region', 'us-west');\n```\n\n## Advanced Usage\n\n### Custom Metadata\n\n```php\n$profiler = new ExcimerProfiler();\n$profiler-\u003eaddMetadata('version', '1.0.0');\n$profiler-\u003eaddMetadata('environment', 'production');\n```\n\n### Async Export\n\n```php\n$backend = new HttpBackend($exporter, 'http://example.com/profiles');\n$backend-\u003esetAsync(true);\n$backend-\u003esend($log); // Returns immediately, sends in background\n```\n\n### Retry Configuration\n\n```php\n$backend = new HttpBackend($exporter, 'http://example.com/profiles');\n$backend-\u003esetRetryConfig(5, 1000); // 5 retries, 1 second delay\n$backend-\u003esend($log);\n```\n\n## Troubleshooting\n\n### Common Issues\n\n#### ext-excimer Not Found\n\nIf you get an error like \"Class 'Excimer' not found\", it means the ext-excimer extension is not installed or not enabled. Make sure you have installed the extension and added it to your php.ini file.\n\n#### Permission Issues\n\nIf you're having trouble saving profiles to a directory, make sure the directory exists and is writable by the PHP process.\n\n#### Memory Issues\n\nProfiling can use a significant amount of memory, especially for long-running processes. If you're experiencing memory issues, try increasing the memory limit in your php.ini file or reducing the sampling frequency.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexcimetry%2Fexcimetry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexcimetry%2Fexcimetry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexcimetry%2Fexcimetry/lists"}