PHPackages                             outsourced/sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. outsourced/sdk

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

outsourced/sdk
==============

PHP SDK for Outsourced API

0.3.0(5y ago)0521MITPHPPHP ^7.2CI failing

Since Jul 8Pushed 5y ago1 watchersCompare

[ Source](https://github.com/pipan/log-outsourced-php-sdk)[ Packagist](https://packagist.org/packages/outsourced/sdk)[ RSS](/packages/outsourced-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (10)Used By (1)

Outsourced PHP SDK
==================

[](#outsourced-php-sdk)

[![Build Status](https://camo.githubusercontent.com/c3267d3880fd7bc0ff3314c02be6aef9c7d64d86c00d57379490e6b9041d34bc/68747470733a2f2f7472617669732d63692e636f6d2f706970616e2f6c6f672d6f7574736f75726365642d7068702d73646b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/pipan/log-outsourced-php-sdk)

PHP SDK for [Outsourced](https://github.com/pipan/log-outsourced-api)

Installation
------------

[](#installation)

`composer require outsourced/sdk`

Usage
-----

[](#usage)

To do any communication with outsourced API, you have to create an `Outsourced` instance. We provide `HttpOutsourced` class. By default, this class uses `Guzzle` as a http client, but you can use other clients, if you want to.

```
use OutsourcedSdk/HttpOutsourced;

$api = HttpOutsourced::makeWithGuzzle([
    'host' => 'https://outsourced.yourdomain.com',
    'accessKey' => 'project-access-key'
]);
```

### Single Log

[](#single-log)

Send single log to outsourced server by calling `logSingle` method of `HttpOutsourced` instance.

```
use OutsourcedSdk/HttpOutsourced;

$api = HttpOutsourced::makeWithGuzzle([
    'host' => 'https://outsourced.yourdomain.com',
    'accessKey' => 'project-access-key'
]);

$api->logSingle('level', 'message', ['context' => 'any additional values']);
```

### Batch log

[](#batch-log)

Send logs in batch to outsourced server by calling `logBatch` method of `HttpOutsourced` instance.

```
use OutsourcedSdk/HttpOutsourced;

$api = HttpOutsourced::makeWithGuzzle([
    'host' => 'https://outsourced.yourdomain.com',
    'accessKey' => 'project-access-key'
]);

$api->logBatch([
    [
        'level' => 'info',
        'message' => 'log #1'
    ], [
        'level' => 'error',
        'message' => 'log #2',
        'context' => [
            'custom' => 'custom value'
        ]
    ]
]);
```

### Additional Context for All Logs

[](#additional-context-for-all-logs)

You may want to add some addition information to all your logs without the need to specify this context when calling `logSingle` or `logBatch`. You can define global context when creating HttpOutsourced instance. Just add `logging.context` index, to config array, with your values.

```
use OutsourcedSdk/HttpOutsourced;

$api = HttpOutsourced::makeWithGuzzle([
    'host' => 'https://outsourced.yourdomain.com',
    'accessKey' => 'project-access-key',
    'logging' => [
        'context' => [
            'environment' => 'production'
        ]
    ]
]);
```

### Verify Permissions

[](#verify-permissions)

Send permission verification request to outsourced server by calling `verifyPermissions` method of `HttpOutsourced` instance.

```
use OutsourcedSdk/HttpOutsourced;

$api = HttpOutsourced::makeWithGuzzle([
    'host' => 'https://outsourced.yourdomain.com',
    'accessKey' => 'project-access-key'
]);

$api->verifyPermissions('username', ['list', 'of', 'permissions']);
```

### Custom HttpClient

[](#custom-httpclient)

Your custom client have to implement `Psr\Http\Client\ClientInterface` interface. Then you can use instance of your class as a first parameter of `make` static method of `HttpOutsourced`.

```
use OutsourcedSdk/HttpOutsourced;

$api = HttpOutsourced::make(new MyClient(), [
    'host' => 'https://outsourced.yourdomain.com',
    'accessKey' => 'project-access-key'
]);

$api->verifyPermissions('username', ['list', 'of', 'permissions']);
```

Logging
-------

[](#logging)

Every log consists of 2 required properties and one optional property

- level - should be one of these 8 options `debug`, `info`, `notice`, `warning`, `error`, `critical`, `alert`, `emergency`
- message - description of logged event
- context \*optional - additional logged values

### Default Context

[](#default-context)

If you create `HttpOutsourced` instance by calling `make` or `makeWithGuzzle` you will automaticaly receive these values in every log context:

- url - current URL
- method - current request method
- ip - user IP
- user\_agent - user agent name
- server - server software
- runtime - language + version (in this case php + php\_version)

### LoggerInterface

[](#loggerinterface)

To use this SDK as a `PSR-3 logger` you can use our implementation of `LoggerInterface`, `OutsourcedLogger`.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~24 days

Recently: every ~37 days

Total

7

Last Release

1993d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/775a7227e0e7d4846459381b3b3d501c394652c515f6500dcea53df6fd0b8b63?d=identicon)[pipan](/maintainers/pipan)

---

Top Contributors

[![pipan](https://avatars.githubusercontent.com/u/8142625?v=4)](https://github.com/pipan "pipan (16 commits)")

---

Tags

loglogginglibrarypermissionsoutsourced

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/outsourced-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/outsourced-sdk/health.svg)](https://phpackages.com/packages/outsourced-sdk)
```

###  Alternatives

[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k227.1M273](/packages/sentry-sentry)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2322.9M248](/packages/open-telemetry-sdk)[markrogoyski/simplelog-php

Powerful PSR-3 logging. So easy, it's simple.

2818.1k4](/packages/markrogoyski-simplelog-php)[oanhnn/laravel-logzio

Integrate Logz.io into PHP and Laravel 5.6+ Application

1062.8k](/packages/oanhnn-laravel-logzio)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
