View on GitHub

SO/!\RCE

a better overview for your PHP microservices' internals and interactions

Plugin / Client

Introduction

This package is the client part of SOARCE - a tool for collecting, reading and analyzing PHP code coverage withing a service oriented architecture / microservice environment. It has to be installed per service as a dev requirement. This library will intercept certain calls to the service/application and either execute necessary code for collecting and storing coverage before/after the actual application code or execute it’s own actions instead.

DO NOT USE IN PRODUCTION!

Although there will be security measures in place, include this library only as a –dev dependency. The intended use is local development or use within a CI/CD pipeline on dedicated integration systems.

Installation

composer.json

{
    "require-dev": {
        "soarce/client": "*"
    }
}

or preferably run this composer command in your project root:

$ composer require --dev --prefer-dist "soarce/client"

In addition, you will have to install and enable xdebug in order to generate code coverage. It has not been included in the “required” section as it would disallow composer-runs without it.

Configuration

ENV-Variables

X-Debug

xdebug.auto_trace = 0
xdebug.trace_format = 1
xdebug.trace_enable_trigger = 0

This is counterintuitive, but, SOARCE triggers coverage and tracing itself.

docker-compose

Currently the client expects a few preconditions at static hostnames/addresses - we plan to add configuration options later:

Debug Interface

Just call the index page of your application - e.g. / or /index.php and add ?SOARCE=index to the call.

This will only work without the security measures in place.

Known Issues

Security

Separating Requests

For within a service architecture we just added a feature that automatically detects the request-id of the parent request and the sequence number of child requests within that parent request.

This currently only works in it’s zero-conf mode when each service is running in it’s own VM or docker container - having a separate IP address - and without having gaps in between - like load balancers or services not equipped with an active SOARCE client. We’ll add additional support options in the future.