PHPackages                             profesia/service-layer - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. profesia/service-layer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

profesia/service-layer
======================

Profesia service layer

v1.6.1(3mo ago)011.9k↓25.4%[1 issues](https://github.com/profesia/service-layer/issues)MITPHPPHP ^8.0CI passing

Since Jul 29Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/profesia/service-layer)[ Packagist](https://packagist.org/packages/profesia/service-layer)[ RSS](/packages/profesia-service-layer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (20)Used By (0)

Service Layer
=============

[](#service-layer)

Library designed for SOA communication via REST with external services

[![Build and test](https://github.com/profesia/service-layer/actions/workflows/test-runner.yml/badge.svg?branch=master)](https://github.com/profesia/psr15-symfony-bundle/actions/workflows/test-runner.yml)[![PHP Version](https://camo.githubusercontent.com/64c5a130f00d357389b4c13d344ae7fc6af1b019c03d33cc5fcc3234f1bc3b92/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f70726f66657369612f736572766963652d6c61796572)](https://camo.githubusercontent.com/64c5a130f00d357389b4c13d344ae7fc6af1b019c03d33cc5fcc3234f1bc3b92/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f70726f66657369612f736572766963652d6c61796572)[![License](https://camo.githubusercontent.com/6c729f1c6e217d87fb24806d9b9da2b79b2b1c35ccca40e0d183347dd08f485e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f70726f66657369612f736572766963652d6c61796572)](https://camo.githubusercontent.com/6c729f1c6e217d87fb24806d9b9da2b79b2b1c35ccca40e0d183347dd08f485e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f70726f66657369612f736572766963652d6c61796572)

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

[](#installation)

Install the latest version by running the command

```
composer require profesia/service-layer
```

Requirements
------------

[](#requirements)

- PHP 8.0+

Quick Start
-----------

[](#quick-start)

For quick prototyping and testing of API endpoints, you can use the `ServiceLayer` facade class:

```
use Profesia\ServiceLayer\Facade\ServiceLayer;
use Profesia\ServiceLayer\ValueObject\HttpMethod;
use Profesia\ServiceLayer\Adapter\Config\AdapterConfig;
use Profesia\ServiceLayer\Adapter\GuzzleAdapter;
use Profesia\ServiceLayer\Transport\Gateway;
use Profesia\ServiceLayer\Transport\Logging\CommunicationLogger;
use Nyholm\Psr7\Factory\Psr17Factory;
use Nyholm\Psr7\Stream;
use Nyholm\Psr7\Uri;
use GuzzleHttp\Client;
use Psr\Log\NullLogger;

// Set up dependencies
$client = new Client();
$adapter = new GuzzleAdapter($client, AdapterConfig::createDefault());
$logger = new CommunicationLogger(new NullLogger());
$gateway = new Gateway($adapter, $logger);
$requestFactory = new Psr17Factory();

// Create a facade instance
$facade = new ServiceLayer($gateway, $requestFactory);

// Make a simple GET request
$uri = new Uri('https://api.example.com/users');
$response = $facade->sendRequest($uri, HttpMethod::createGet());

// Make a POST request with a body
$uri = new Uri('https://api.example.com/users');
$body = Stream::create(json_encode(['name' => 'John Doe']));
$response = $facade->sendRequest($uri, HttpMethod::createPost(), $body);

// Make a request with custom client options (timeout, SSL verification, etc.)
$clientOptions = ['timeout' => 10.0, 'verify' => false];
$response = $facade->sendRequest($uri, HttpMethod::createGet(), null, $clientOptions);

// Use builder pattern with custom response mapper
$response = $facade
    ->withMapperClosure(function ($endpointResponse) {
        // Custom response transformation logic
        return MyCustomResponse::fromEndpoint($endpointResponse);
    })
    ->sendRequest($uri, HttpMethod::createGet());

// Use builder pattern with client options (state is reset after each request)
$response = $facade
    ->withClientOptions(['timeout' => 10.0, 'verify' => false])
    ->executeRequest($uri, HttpMethod::createGet());

// Check the response
if ($response->isSuccessful()) {
    echo $response->getResponseBody();
}
```

See the [examples](examples/service-layer-usage.php) directory for more usage examples.

Documentation
-------------

[](#documentation)

The documentation for the bundle can be found at

Author
------

[](#author)

Matej Bádal -

Alma Career Slovakia s r.o.

License
-------

[](#license)

This project is licensed under the MIT License

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance78

Regular maintenance activity

Popularity26

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity61

Established project with proven stability

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

Recently: every ~100 days

Total

16

Last Release

117d ago

Major Versions

v0.9.0 → v1.0.0-rc.12022-08-09

PHP version history (2 changes)v0.9.0PHP ^7.4 || ^8.0

v1.2.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/c1133781cc2788a97f1f23f431bf96d0e265312bfe6ea1bd1a542e51cf698342?d=identicon)[profesia-company](/maintainers/profesia-company)

---

Top Contributors

[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (1 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/profesia-service-layer/health.svg)

```
[![Health](https://phpackages.com/badges/profesia-service-layer/health.svg)](https://phpackages.com/packages/profesia-service-layer)
```

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[aporat/store-receipt-validator

PHP receipt validator for Apple App Store and Amazon Appstore

6503.9M9](/packages/aporat-store-receipt-validator)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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