Download the PHP package gemvc/apm-tracekit without Composer

On this page you can find all versions of the php package gemvc/apm-tracekit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package apm-tracekit

gemvc_header_for_github

GEMVC APM TraceKit Provider

License: MIT PHP Version

TraceKit APM provider implementation for GEMVC framework. This package implements the GEMVC APM Contracts interface, providing distributed tracing and performance monitoring for GEMVC applications.

โฌ‡๏ธ Installation

TraceKit is automatically included when you install gemvc/library - no separate installation required!

If you're using GEMVC framework, TraceKit APM is already available and ready to configure. Simply run the setup wizard:

Note: If you need to install this package standalone (outside of GEMVC framework), you can still use:

This package automatically installs gemvc/apm-contracts as a dependency, which provides the base interfaces and abstract classes.

๐ŸŽฏ Architecture

This package is built on top of the GEMVC APM Contracts package:

Key Components:

๐Ÿ” Configuration

Environment Variables

Set in your .env file:

Note: The TraceKit endpoint URL (https://app.tracekit.dev/v1/traces) is pre-configured as a library constant and does not need to be set in your .env file. If you need to override it (e.g., for custom deployments), you can set TRACEKIT_ENDPOINT in your .env file.

Configuration Priority

Configuration values are loaded in the following priority order:

  1. Config array (passed to constructor/init) - Highest priority
  2. Provider-specific env vars (TRACEKIT_*) - Medium priority
  3. Unified APM env vars (APM_*) - Lower priority
  4. Default values - Lowest priority

Unified API Key Support

You can use either TRACEKIT_API_KEY or the unified APM_API_KEY environment variable:

Quick Setup with CLI Command

The easiest way to configure TraceKit is using the interactive CLI command:

This command provides an interactive wizard that:

Setup Options:

  1. Easy Register - Automated registration with email verification
  2. I have API key - Manual entry of existing API key

See the CLI Setup Wizard section below for detailed information.

๐Ÿ’ก Usage

Automatic Integration

Once installed and configured, TraceKit automatically integrates with GEMVC:

  1. Framework Initialization - The framework creates a TraceKitProvider instance via ApmFactory::create()
  2. Root Trace Creation - A root span is automatically created for each HTTP request
  3. Span Management - Child spans are created for database queries, controller operations, etc.
  4. Trace Batching - Traces are automatically batched and sent every 5 seconds (configurable via APM_SEND_INTERVAL) using synchronous ApiCall
  5. Shutdown Safety - All pending traces are sent immediately on shutdown to ensure no data loss

Manual Span Creation

You can create custom spans in your code:

Using TraceKit Toolkit

The TraceKitToolkit class provides client-side integration features:

CLI Setup Wizard

The tracekit init command provides an interactive setup wizard for configuring TraceKit:

What the wizard does:

  1. Welcome Banner - Displays TraceKit features and welcome message
  2. Configuration Detection - Checks for existing TraceKit configuration
    • If found, offers to reconfigure, test connection, or exit
  3. Setup Method Selection:
    • Easy Register (Recommended)
      • Prompts for email and organization name
      • Sends registration request to TraceKit
      • Sends verification code to your email
      • Waits for you to enter the verification code (CLI does not exit)
      • Supports retry logic (max 3 attempts)
      • Automatically receives and saves API key
    • I have API key
      • Prompts for existing API key
      • Validates API key format
  4. Service Name Setup - Prompts for unique service name with validation
  5. Automatic Configuration - Updates .env file with:
    • TRACEKIT_API_KEY - Your API key
    • TRACEKIT_SERVICE_NAME - Your service name
    • APM_NAME="TraceKit" - Provider name
    • APM_ENABLED="true" - Enable APM
  6. Connection Test - Verifies API key and connection to TraceKit service
  7. Success Message - Displays confirmation and next steps

Example Flow:

Note: The CLI command is part of the GEMVC framework and uses standard CLI infrastructure (Command, CliBoxShow, ProjectHelper).

โœจ Features

OpenTelemetry OTLP JSON Format

Batch Trace Sending

Span Management

๐Ÿ“– API Reference

TraceKitProvider

Main provider class implementing ApmInterface (used by ApmFactory):

Instance Methods:

Static Methods:

Note: TraceKitModel is an alternative implementation with additional methods like addEvent(), getSampleRate(), getSampleRatePercent(), and getActiveSpan().

TraceKitToolkit

Client-side integration class implementing ApmToolkitInterface:

For complete API documentation, see the GEMVC APM Contracts README.

๐Ÿ”„ Related Packages

๐ŸŒ Environment Variables Reference

Core APM Variables

TraceKit-Specific Variables

๐Ÿงช Development

Running Tests

All tests pass successfully (87 tests, 200 assertions). The test suite includes stub files for GEMVC framework classes to enable independent testing without requiring the full framework installation.

Code Quality

PHPStan passes with no errors at level 9. Stub files for GEMVC framework classes are automatically loaded via phpstan.neon configuration for static analysis.

Stub Files

This package includes stub files in the stubs/ directory for GEMVC framework classes. These stubs serve two purposes:

  1. PHPStan Static Analysis - Loaded via phpstan.neon bootstrap configuration
  2. PHPUnit Test Execution - Loaded via tests/bootstrap.php for runtime testing

The stub files provide minimal implementations with correct method signatures and type hints, allowing the package to be analyzed and tested independently.

โš–๏ธ License

MIT License - see LICENSE file for details.

๐Ÿ‘ฅ Contributing

Contributions are welcome! Please see the GEMVC APM Contracts README for information about the APM provider architecture.

Credits

Part of the GEMVC PHP Framework built for Microservices ecosystem. made with love By Ali Khorsandfard


All versions of apm-tracekit with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
gemvc/apm-contracts Version ^1.4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package gemvc/apm-tracekit contains the following files

Loading the files please wait ...