PHPackages                             athlan/press-server-api-client - 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. [API Development](/categories/api)
4. /
5. athlan/press-server-api-client

ActiveLibrary[API Development](/categories/api)

athlan/press-server-api-client
==============================

Press Server API Client

0.2.1(9y ago)026MITPHP

Since Dec 23Pushed 9y ago1 watchersCompare

[ Source](https://github.com/athlan/press-server-api-client)[ Packagist](https://packagist.org/packages/athlan/press-server-api-client)[ RSS](/packages/athlan-press-server-api-client/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (5)Used By (0)

PressServer API Client
======================

[](#pressserver-api-client)

[![travis](https://camo.githubusercontent.com/bd4716fb942d0ca429ed519f7865842e4cbca0bba7ddb48d4c1db619a8b16006/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6174686c616e2f70726573732d7365727665722d6170692d636c69656e742f6d61737465722e737667)](https://camo.githubusercontent.com/bd4716fb942d0ca429ed519f7865842e4cbca0bba7ddb48d4c1db619a8b16006/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6174686c616e2f70726573732d7365727665722d6170692d636c69656e742f6d61737465722e737667)[![license](https://camo.githubusercontent.com/7f6b587ca3f335d866a26a239d5bccd13fa39086a9277497ae2322f8de4ff417/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6174686c616e2f70726573732d7365727665722d6170692d636c69656e742e737667)](https://camo.githubusercontent.com/7f6b587ca3f335d866a26a239d5bccd13fa39086a9277497ae2322f8de4ff417/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6174686c616e2f70726573732d7365727665722d6170692d636c69656e742e737667)[![version](https://camo.githubusercontent.com/236b4cdae8c70c70c00dcc6534e92e8527782d98271500953c7b8fb5e5ad91c3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6174686c616e2f70726573732d7365727665722d6170692d636c69656e742e737667)](https://camo.githubusercontent.com/236b4cdae8c70c70c00dcc6534e92e8527782d98271500953c7b8fb5e5ad91c3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6174686c616e2f70726573732d7365727665722d6170692d636c69656e742e737667)

This library allows you to receive callback request from [Press Server](http://www.press-server.pl/).

Recommendations
---------------

[](#recommendations)

- **Keep in mind that order of events matters.**Try to retreive operations, reverse it order and store/process in correct order because of occuring dependencies. For example an announcement add event depends on category creation event.
- **Store events locally for further processing.**

    Try to retreive events data from Press Server and store them locally for futher processing to not cause Press Server wait for your processing. Just store event content to your local event sotre (files, database) and process them in separate thread or in scheduled task (for example cron).

    The example with simple filestore is included in `/example` directory.

Example usage
-------------

[](#example-usage)

Example usage is in `/example` directory.

```
use GuzzleHttp\Psr7\ServerRequest;
use PressServerApi\Callback\OperationInterface;
use PressServerApi\Callback\Operation\Factory\Psr7Request\OperationsFromRequestFactory;
use PressServerApi\Callback\Operation\Factory\OperationFactoryInterface;
use PressServerApi\Callback\Operation\Factory\AnnouncementOperationFactory;
use PressServerApi\Callback\Operation\Factory\AnnouncementDeleteOperationFactory;
use PressServerApi\Callback\Operation\Factory\AnnouncementPhotoOperationFactory;
use PressServerApi\Callback\Operation\Factory\AnnouncementPhotoDeleteOperationFactory;
use PressServerApi\Callback\Operation\Factory\CategoryOperationFactory;
use PressServerApi\Callback\Operation\Factory\CategoryDeleteOperationFactory;
use PressServerApi\Callback\Operation\Factory\UnknownOperationFactory;
use PressServerApi\Callback\OperationGroupProcessingResult;
use PressServerApi\Callback\OperationProcessingResult;
use PressServerApi\Callback\Response\ProcessingResultResponseFactory;
use PressServerApi\Callback\Response\Psr7Response\ProcessingResultResponseFactory as ProcessingResultPsr7ResponseFactory;

use Example\EventStore\Event;
use Example\EventStore\EventStoreInterface;
use Example\EventStore\SimpleFilesystemEventStore;
use Example\EventStore\Exception\EventAlreadyInStoreException;

use function QuimCalpe\ResponseSender\send AS send_response;

include 'vendor/autoload.php';

// Step 1. Configure Context (components).
$responseFactory = new ProcessingResultResponseFactory();
$responseFactoryPsr7 = new ProcessingResultPsr7ResponseFactory($responseFactory);

/* @var $factories OperationFactoryInterface[] */
$factories = [
    new AnnouncementOperationFactory(),
    new AnnouncementDeleteOperationFactory(),
    new AnnouncementPhotoOperationFactory(),
    new AnnouncementPhotoDeleteOperationFactory(),
    new CategoryOperationFactory(),
    new CategoryDeleteOperationFactory(),
    new UnknownOperationFactory(),
];

$operationsFromRequestFactory = new OperationsFromRequestFactory($factories);

// Step 2. Receive HTTP Request and get operations.
$request = ServerRequest::fromGlobals();

// validate
if($request->getMethod() != "POST") {
    return send_response(new \GuzzleHttp\Psr7\Response(401));
}

/* @var $eventStore EventStoreInterface */
$eventStore = new SimpleFilesystemEventStore('./eventstore');

/* @var $operations OperationInterface[] */
$operations = $operationsFromRequestFactory->createOperations($request);
$operations = array_reverse($operations);

$results = new OperationGroupProcessingResult();

foreach($operations as $operation) {
    // TODO process operation here...
    // here there is storing events for further processing, which is recommended way
    // to fast and reliable retrieve events from 3rd party callback
    try {
        $eventStore->store(new Event($operation->getOperationKey(), $operation));
    }
    catch(EventAlreadyInStoreException $e) {
    }

    // after processing, create the OperarionProcessingResult (success or failure)
    $result = OperationProcessingResult::createResultSuccess($operation);
    $results->addResult($result);
}

// Step 3. Prepare response.
$response = $responseFactoryPsr7->createProcessingResultResponse($results);

// Step 4. Send response.
return send_response($response);
```

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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 ~3 days

Total

3

Last Release

3468d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/742606eed947fa5901c0a42a19885bc8802c7e93d1d714bb5b4dca73bf8c3797?d=identicon)[athlan](/maintainers/athlan)

---

Top Contributors

[![athlan](https://avatars.githubusercontent.com/u/2697638?v=4)](https://github.com/athlan "athlan (21 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/athlan-press-server-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/athlan-press-server-api-client/health.svg)](https://phpackages.com/packages/athlan-press-server-api-client)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.2M46](/packages/tencentcloud-tencentcloud-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k496.1k33](/packages/neuron-core-neuron-ai)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.3M7](/packages/avalara-avataxclient)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2478.1k](/packages/filescom-files-php-sdk)[aimeos/prisma

A powerful PHP package for integrating media related Large Language Models (LLMs) into your applications

1942.4k4](/packages/aimeos-prisma)

PHPackages © 2026

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