Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
php-version: ${{ matrix.php-versions }}
tools: composer

- name: Validate composer.json and composer.lock
run: composer validate --no-check-all --no-check-publish
- name: Install Perfbase
run: bash -c "$(curl -fsSL https://cdn.perfbase.com/install.sh)"

- name: Install dependencies
run: composer install --prefer-dist --no-progress
Expand Down
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
ARG PHP_VERSION=8.4
FROM php:${PHP_VERSION}-fpm

ENV PATH="/composer/vendor/bin:$PATH"
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV COMPOSER_HOME=/composer

COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer

# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
git \
wget \
unzip \
libzip-dev \
libonig-dev \
libxml2-dev \
&& docker-php-ext-install pdo pdo_mysql zip mbstring bcmath \
&& apt-get clean

# Set the safe directory for git
RUN git config --global --add safe.directory /var/www/html

# Install Perfbase
RUN bash -c "$(curl -fsSL https://cdn.perfbase.com/install.sh)"

# Set working directory
WORKDIR /app

# Install PHP dependencies
COPY composer.json ./composer.json
RUN composer install --prefer-dist --no-progress --no-scripts

# Copy project files to container
COPY . .

# Add Composer's global bin directory to PATH
ENV PATH="/composer/vendor/bin:$PATH"

# Default Entrypoint
ENTRYPOINT []
45 changes: 30 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
{
"name": "perfbase/php-sdk",
"description": "An SDK for sending profiling data to Perfbase",
"keywords": [
"Perfbase",
"php",
"profiling"
],
"homepage": "https://github.com/perfbaseorg/php-sdk",
"support": {
"issues": "https://github.com/perfbaseorg/php-sdk/issues",
"source": "https://github.com/perfbaseorg/php-sdk"
},
"type": "library",
"license": "Apache-2.0",
"autoload": {
"psr-4": {
"Perfbase\\SDK\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Perfbase\\SDK\\Tests\\": "tests/"
}
},
"authors": [
{
"name": "Ben Poulson",
"email": "ben.poulson@perfbase.com"
}
],
"scripts": {
"lint": "composer run-script phpstan && composer run-script test",
"test": "phpunit",
"phpstan": "phpstan analyse --memory-limit=2G"
},
"require": {
"php": ">=7.4 <8.5",
"ext-curl": "*",
Expand All @@ -33,5 +28,25 @@
"phpstan/phpstan": "^2.1",
"mockery/mockery": "^1.6",
"phpunit/phpunit": "^9"
},
"autoload": {
"psr-4": {
"Perfbase\\SDK\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Perfbase\\SDK\\Tests\\": "tests/"
}
},
"scripts": {
"lint": "composer run-script phpstan && composer run-script test",
"test": "phpunit",
"phpstan": "phpstan analyse --memory-limit=2G"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true
}
}
30 changes: 0 additions & 30 deletions docker/Dockerfile-7.4

This file was deleted.

30 changes: 0 additions & 30 deletions docker/Dockerfile-8.0

This file was deleted.

30 changes: 0 additions & 30 deletions docker/Dockerfile-8.1

This file was deleted.

30 changes: 0 additions & 30 deletions docker/Dockerfile-8.2

This file was deleted.

30 changes: 0 additions & 30 deletions docker/Dockerfile-8.3

This file was deleted.

30 changes: 0 additions & 30 deletions docker/Dockerfile-8.4

This file was deleted.

47 changes: 47 additions & 0 deletions src/Extension/ExtensionInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace Perfbase\SDK\Extension;

interface ExtensionInterface
{
/**
* Check if the Perfbase extension is loaded and available
* @return bool
*/
public function isAvailable(): bool;

/**
* Starts the Perfbase profiler
* @param string $spanName The name of the span to start profiling
* @param int $flags Flags to enable specific profiling features
* @return void
*/
public function enable(string $spanName, int $flags): void;

/**
* Stops the Perfbase profiler
* @param string $spanName The name of the span to stop profiling
* @return void
*/
public function disable(string $spanName): void;

/**
* Retrieves the collected profiling data
* @return string
*/
public function getData(): string;

/**
* Clears the collected profiling data and resets the profiler
* @return void
*/
public function reset(): void;

/**
* Sets an attribute for the Perfbase profiler
* @param string $key
* @param string $value
* @return void
*/
public function setAttribute(string $key, string $value): void;
}
Loading