Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
788a638
Decode user data so it can be properly re-encoded
tarecord Oct 30, 2023
7db92eb
Merge branch 'main' into develop
borkweb Jan 8, 2024
9b35f39
Resolve issues with dependencies (#108)
borkweb Jan 8, 2024
572c105
Add a .gitattributes file. (#107)
TimothyBJacobs Jan 8, 2024
88e6c76
Define missing services in the Container. (#106)
TimothyBJacobs Jan 8, 2024
a4bc84f
Add Workflow Status Badges to README (#103)
tarecord Jan 8, 2024
4ba678e
Update actions used in workflows
tarecord Nov 12, 2024
7d07e1c
Fix incorrect shivammathur/php-setup version
tarecord Nov 12, 2024
4dff32a
Install required dependencies of test plugin
tarecord Nov 12, 2024
226448f
Merge pull request #114 from stellarwp/fix/routine-maintenance
tarecord Nov 12, 2024
cb30209
Added generic filter on the show-optin option key (#115)
renventura Jan 28, 2025
3982998
Patch some missed TBDs
Camwyn Feb 10, 2025
29bbcec
Merge pull request #116 from stellarwp/fix/TBDs
bordoni Apr 24, 2025
0a9feec
Check user permissions for subscriber actions.
Camwyn Apr 25, 2025
f82169f
Merge branch 'develop' into fix/added-security
Camwyn Apr 25, 2025
7407e8d
Update src/Telemetry/Exit_Interview/Exit_Interview_Subscriber.php
Camwyn Apr 25, 2025
da05a71
Move current_user_can to last check as it requires a database hit.
Camwyn Apr 25, 2025
9b23218
Proposed additional security tweaks.
Camwyn Apr 25, 2025
aa082f7
Merge pull request #118 from stellarwp/fix/additional-tweaks
tarecord Apr 25, 2025
c7be0cf
Minimizing changes
tarecord Apr 25, 2025
67b8d74
Add new since tags to document changes
tarecord Apr 25, 2025
74c7b81
Merge pull request #117 from stellarwp/fix/added-security
tarecord Apr 25, 2025
4cc1b52
Add CLAUDE.md for Claude Code guidance
borkweb Jun 26, 2025
74b0eca
Update blue colors to match Liquid Web brand palette
d4mation Apr 9, 2026
202a530
Merge pull request #121 from stellarwp/feature/liquid-web-blue-rebrand
d4mation Apr 9, 2026
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
15 changes: 15 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/.github export-ignore
/dev export-ignore
/docs export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.env.testing export-ignore
/.env.testing.slic export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.lando.yml export-ignore
/codeception.dist.yml export-ignore
/codeception.slic.yml export-ignore
/CONTRIBUTING.md export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
21 changes: 5 additions & 16 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,20 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ["7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
php-version: ["7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Configure PHP environment
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
extensions: mbstring, intl
coverage: none

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- uses: ramsey/composer-install@v2
with:
dependency-versions: highest
- name: Composer Install
uses: ramsey/composer-install@v3

- name: Run PHP Compatibility
run: composer compatibility:php-${{ matrix.php-version }}
6 changes: 3 additions & 3 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Configure PHP environment
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
- uses: ramsey/composer-install@v2
php-version: '8.2'
- uses: ramsey/composer-install@v3
with:
composer-options: "--ignore-platform-reqs --optimize-autoloader"
- name: Run PHPCS
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Configure PHP environment
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
- uses: ramsey/composer-install@v2
php-version: '8.2'
- uses: ramsey/composer-install@v3
with:
composer-options: "--ignore-platform-reqs --optimize-autoloader"
- name: Run PHPStan
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
with:
fetch-depth: 1000
submodules: recursive
uses: actions/checkout@v4
# ------------------------------------------------------------------------------
# Checkout slic
# ------------------------------------------------------------------------------
- name: Checkout slic
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: stellarwp/slic
ref: main
path: slic
fetch-depth: 1
# ------------------------------------------------------------------------------
# Prepare our composer cache directory
# ------------------------------------------------------------------------------
- name: Get Composer Cache Directory
id: get-composer-cache-dir
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
- uses: actions/cache@v4
id: composer-cache
with:
path: ${{ steps.get-composer-cache-dir.outputs.dir }}
Expand Down
1 change: 1 addition & 0 deletions .lando.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ events:
post-start:
- appserver: composer install
- appserver: /app/dev/lando/install-wp.sh
- appserver: cd /app/dev/public/wp-content/plugins/library-testing && composer install
post-destroy:
- appserver: rm -rf /app/dev/public/wp
86 changes: 86 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

This is the StellarWP Telemetry Library - a PHP library for WordPress plugins that provides opt-in telemetry data collection. The library is designed to be included via Composer (preferably with Strauss for namespace isolation) and provides a complete telemetry solution with user privacy controls.

## Common Development Commands

### Testing
```bash
# Run unit tests using slic (StellarWP's testing framework)
slic run wpunit

# Run static analysis
composer test:analysis
```

### Code Quality
```bash
# Check coding standards
phpcs ./src

# Auto-fix coding standard issues
phpcbf ./src

# Check PHP compatibility for all supported versions (7.1-8.3)
composer compatibility

# Check specific PHP version compatibility
composer compatibility:php-8.0
```

### Local Development
```bash
# Start local development environment
lando start

# Install dependencies via Lando
lando composer install

# Local site will be available at: https://telemetry-library.lndo.site/
```

## High-Level Architecture

### Core Components

1. **Dependency Injection Container**: The library requires a DI container compatible with `stellarwp/container-contract`. The container must be configured before initializing the library.

2. **Opt-In System**:
- `Opt_In/` - Manages user consent through modal interfaces
- `Exit_Interview/` - Collects feedback when plugins are deactivated
- Privacy-first approach with explicit user consent required

3. **Data Collection**:
- `Data_Providers/` - Abstract data collection with providers like `Debug_Data` for Site Health integration
- `Events/` - Event tracking system for capturing user actions
- `Telemetry/` - Core functionality for sending telemetry data to the server

4. **Integration Points**:
- `Admin/` - WordPress admin integration and resource management
- `Last_Send/` - Tracks when telemetry was last sent
- Uses subscriber pattern (`Abstract_Subscriber`) for WordPress hooks

### Key Design Patterns

- **Subscriber Pattern**: All WordPress hook integrations use the subscriber pattern through `Abstract_Subscriber`
- **Template System**: UI components use template interfaces for rendering
- **Modular Design**: Clear separation between opt-in, telemetry, events, and exit interview functionality
- **Multi-Plugin Support**: Designed to be shared across multiple plugins using `Config::add_stellar_slug()`

### Integration Requirements

1. Initialize with a compatible DI container
2. Configure server URL and hook prefix
3. Set a unique stellar slug for plugin identification
4. Call `Telemetry::instance()->init(__FILE__)` to start

### Testing Approach

- Uses Codeception with WordPress browser testing
- Tests run via `slic` command in CI/CD
- PHPStan level 5 for static analysis
- PHPCS with WordPress VIP Go and TEC standards
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Telemetry Library
![Tests](https://github.com/stellarwp/telemetry/actions/workflows/tests.yml/badge.svg)
![Coding Standards](https://github.com/stellarwp/telemetry/actions/workflows/phpcs.yml/badge.svg)
![PHP Compatibility](https://github.com/stellarwp/telemetry/actions/workflows/compatibility.yml/badge.svg)
![Static Analysis](https://github.com/stellarwp/telemetry/actions/workflows/phpstan.yml/badge.svg)

A library for Opt-in and Telemetry data to be sent to the StellarWP Telemetry server.

Expand Down
10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
"stellarwp/container-contract": "^1.0"
},
"require-dev": {
"automattic/vipwpcs": "^2.3",
"automattic/vipwpcs": "^3.0.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
"lucatume/di52": "3.0.0",
"lucatume/wp-browser": "^4.0",
"lucatume/wp-browser": "^3.2.3",
"phpcompatibility/phpcompatibility-wp": "*",
"phpunit/php-code-coverage": "^9.2",
"szepeviktor/phpstan-wordpress": "^1.1",
"the-events-calendar/coding-standards": "dev-master",
"wp-coding-standards/wpcs": "^2.3"
"wp-coding-standards/wpcs": "^3.0.0"
},
"repositories": [
{
Expand All @@ -55,14 +55,16 @@
"compatibility:php-8.0": "phpcs ./src -s --standard=PHPCompatibilityWP --runtime-set testVersion 8.0",
"compatibility:php-8.1": "phpcs ./src -s --standard=PHPCompatibilityWP --runtime-set testVersion 8.1",
"compatibility:php-8.2": "phpcs ./src -s --standard=PHPCompatibilityWP --runtime-set testVersion 8.2",
"compatibility:php-8.3": "phpcs ./src -s --standard=PHPCompatibilityWP --runtime-set testVersion 8.3",
"compatibility": [
"@compatibility:php-7.1",
"@compatibility:php-7.2",
"@compatibility:php-7.3",
"@compatibility:php-7.4",
"@compatibility:php-8.0",
"@compatibility:php-8.1",
"@compatibility:php-8.2"
"@compatibility:php-8.2",
"@compatibility:php-8.3"
]
},
"scripts-descriptions": {
Expand Down
Loading
Loading