PHPackages                             masmerise/scrada-php-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. [API Development](/categories/api)
4. /
5. masmerise/scrada-php-sdk

ActiveLibrary[API Development](/categories/api)

masmerise/scrada-php-sdk
========================

An unofficial PHP SDK for accessing Scrada's API.

1.1.1(2mo ago)1881MITPHPPHP ~8.5CI passing

Since Nov 4Pushed 2mo agoCompare

[ Source](https://github.com/masmerise/scrada-php-sdk)[ Packagist](https://packagist.org/packages/masmerise/scrada-php-sdk)[ Docs](https://github.com/masmerise/scrada-php-sdk)[ RSS](/packages/masmerise-scrada-php-sdk/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (24)Versions (7)Used By (1)

[![Scrada PHP SDK](https://camo.githubusercontent.com/179a17939ec257d9ca450cb4b1f8a67273a3a1881755902e58b0323a000807bd/68747470733a2f2f7777772e7363726164612e62652f77702d636f6e74656e742f75706c6f6164732f323032332f31302f5363726164614c6f676f576562736974652e706e67)](https://camo.githubusercontent.com/179a17939ec257d9ca450cb4b1f8a67273a3a1881755902e58b0323a000807bd/68747470733a2f2f7777772e7363726164612e62652f77702d636f6e74656e742f75706c6f6164732f323032332f31302f5363726164614c6f676f576562736974652e706e67)[![PHP](https://camo.githubusercontent.com/4b0aa075e2e98f282839bf07cbc3199b059e258abca5b928f0e3a982245d472c/68747470733a2f2f7777772e7068702e6e65742f696d616765732f6c6f676f732f7068702d6c6f676f2e737667)](https://camo.githubusercontent.com/4b0aa075e2e98f282839bf07cbc3199b059e258abca5b928f0e3a982245d472c/68747470733a2f2f7777772e7068702e6e65742f696d616765732f6c6f676f732f7068702d6c6f676f2e737667)

[![Build Status](https://github.com/masmerise/scrada-php-sdk/actions/workflows/test.yml/badge.svg)](https://github.com/masmerise/scrada-php-sdk/actions)[![Total Downloads](https://camo.githubusercontent.com/eebc009d667a2fe970af7214ae978f2eb4c0106a278e5579ac5bf989f2444807/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d61736d65726973652f7363726164612d7068702d73646b)](https://packagist.org/packages/masmerise/scrada-php-sdk)[![Latest Stable Version](https://camo.githubusercontent.com/0a3bb79b0c235bed868d9f6f5f9f7318b370d09d5f17a27438aed37bb04f70c4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d61736d65726973652f7363726164612d7068702d73646b)](https://packagist.org/packages/masmerise/scrada-php-sdk)[![License](https://camo.githubusercontent.com/4033521c1ad96b63682dcf06609163c36ef6b6552985bfc164e1c0f8416b2b79/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d61736d65726973652f7363726164612d7068702d73646b)](https://packagist.org/packages/masmerise/scrada-php-sdk)

Scrada PHP SDK
--------------

[](#scrada-php-sdk)

This SDK provides convenient, fully-typed access to [Scrada's API](https://www.scrada.be/api-documentation/).

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

[](#installation)

You can install the package via [composer](https://getcomposer.org):

```
composer require masmerise/scrada-php-sdk
```

### Adapters

[](#adapters)

You may also use one of the available adapters instead:

- [Laravel](https://github.com/masmerise/scrada-for-laravel)

Getting started
---------------

[](#getting-started)

You can always refer to the [documentation](https://www.scrada.be/api-documentation/) to examine the various resources that are available.

### Setup

[](#setup)

```
use Scrada\Authentication\Credentials;
use Scrada\Scrada;

$credentials = Credentials::present(
    key: '4844a45c-33d1-4937-83f4-366d36449eaf',
    password: 'SajA1NOEphxVMwTTFzrDswj3AQkEGCCJ',
);

$scrada = Scrada::authenticate($credentials);
```

### Data retrieval

[](#data-retrieval)

```
use Scrada\Company\Type\Primitive\CompanyId;

$company = CompanyId::fromString('4ccc0005-0bdd-430b-8f45-264c3f1a2a02');
$company = $scrada->company->get($company);
```

### Resource update

[](#resource-update)

```
use Scrada\CashBook\Type\Primitive\CashBookId;
use Scrada\CashBook\Type\Primitive\CodaGenerationPeriod;
use Scrada\CashBook\Type\Primitive\Name;
use Scrada\CashBook\Update\UpdateCashBook;
use Scrada\Company\Type\Primitive\CompanyId;

$companyId = CompanyId::fromString('4ccc0005-0bdd-430b-8f45-264c3f1a2a02');

$cashBookId = CashBookId::fromString('d84835b0-7125-4f8f-b10a-957a0cc73089');

$data = UpdateCashBook::parameters(
    name: Name::fromString('Acme Inc.'),
    codaGenerationPeriodType: CodaGenerationPeriod::EveryDay,
);

$scrada->cashBook->update($companyId, $cashBookId, $data);
```

Failures (exception handling)
-----------------------------

[](#failures-exception-handling)

The SDK uses exceptions as its medium to communicate failures.

```
ScradaException
├── CouldNotAuthenticate (Authentication Errors)
├── UnknownException (Connection Errors)
└── ValidationException (Request Errors)
    ├── CouldNotGetCompany
    ├── CouldNotUpdateCompany
    ├── CouldNotGetAllCashBooks
    ├── CouldNotUpdateCashBook
    └── ...

```

```
use Scrada\Company\Get\Failure\CouldNotGetCompany;

try {
    $company = $scrada->company->get($id);
} catch (CouldNotGetCompany $ex) {
    $logger->log($ex->getMessage());
}
```

### API failures

[](#api-failures)

API interaction failures, i.e. exceptions of type `ValidationException`, always expose a special `ScradaError` object that contains the API's reasons for rejection:

```
use Scrada\Company\Get\Failure\CouldNotGetCompany;

try {
    $company = $scrada->company->get($id);
} catch (CouldNotGetCompany $ex) {
    $scradaError = $ex->error;

    $logger->log($scradaError->defaultFormat); // Localized error text
}
```

Rate limiting
-------------

[](#rate-limiting)

The SDK is equipped with out-of-the-box capabilities to deal with Scrada's request constraints. In order to make use of this, you will have to provide a [`PSR-16`](https://www.php-fig.org/psr/psr-16/) compatible cache store so the SDK can keep track of its current state.

Chances are that you are going to use this SDK in conjunction with a popular web framework, and most of them already have a PSR-16 compatible implementation of a cache store available:

```
$store = Container::getInstance()->get('cache');

$scrada = Scrada::authenticate(
    Credentials::present(...)
)->withStore($store);
```

Localization
------------

[](#localization)

You can use one of the available methods to change the API's language:

### Dutch

[](#dutch)

```
$scrada->useDutch();
```

### English (default)

[](#english-default)

```
$scrada->useEnglish();
```

### French

[](#french)

```
$scrada->useFrench();
```

Environment
-----------

[](#environment)

You can use one of the available methods to change the API's environment:

### Production (default)

[](#production-default)

```
$scrada->useProduction();
```

### Test

[](#test)

```
$scrada->useTest();
```

Retries
-------

[](#retries)

The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long as the request is deemed retriable and the number of retry attempts has not grown larger than the default retry limit (2).

A request is deemed retriable when any of the following HTTP status codes is returned:

- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)

Timeouts
--------

[](#timeouts)

The SDK defaults to a 10 second timeout.

Implementation progress
-----------------------

[](#implementation-progress)

ResourceActionCash bookGet all cash booksUpdate cash bookCompanyGet companyUpdate companyWhile the SDK is battle-tested and production-ready, only a handful of API interactions have been implemented thus far. Please bear in mind this is an unofficial SDK, so we have to prioritize available resources at this time.

However, always feel free to submit a feature or pull request!

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Muhammed Sari](https://github.com/mabdullahsari)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance84

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity57

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

Total

5

Last Release

81d ago

Major Versions

0.2.0 → 1.0.02026-03-26

PHP version history (2 changes)0.1.0PHP ~8.4

0.2.0PHP ~8.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/124146093?v=4)[Masmerise](/maintainers/masmerise)[@masmerise](https://github.com/masmerise)

---

Top Contributors

[![mabdullahsari](https://avatars.githubusercontent.com/u/24608797?v=4)](https://github.com/mabdullahsari "mabdullahsari (19 commits)")

---

Tags

apisdkscrada

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/masmerise-scrada-php-sdk/health.svg)

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

###  Alternatives

[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M159](/packages/algolia-algoliasearch-client-php)[saloonphp/laravel-plugin

The official Laravel plugin for Saloon

807.1M200](/packages/saloonphp-laravel-plugin)[webit/w-firma-api

wFirma.pl API

1822.0k](/packages/webit-w-firma-api)

PHPackages © 2026

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