PHPackages                             fw4/mason-api - 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. fw4/mason-api

ActiveLibrary[API Development](/categories/api)

fw4/mason-api
=============

PHP library for implementing the Mason External API

v1.0.0(today)00MITPHPPHP ^8.4CI passing

Since Jul 28Pushed todayCompare

[ Source](https://github.com/fw4-bvba/mason-api)[ Packagist](https://packagist.org/packages/fw4/mason-api)[ RSS](/packages/fw4-mason-api/feed)WikiDiscussions feature/initial Synced today

READMEChangelog (1)Dependencies (8)Versions (3)Used By (0)

Mason External API
==================

[](#mason-external-api)

PHP client for the Mason External API. For terms of use and request/response schema, refer to the official documentation.

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

[](#installation)

This package requires PHP 8.4 or newer.

`composer require fw4/mason-api`

Usage
-----

[](#usage)

```
use Mason\Api\Client;

$api = new Client('client-id', 'client-secret');
$group = $api->group(123);
```

### Available endpoints

[](#available-endpoints)

Use the following methods to access available endpoints:

#### Estates

[](#estates)

```
$group->estates->list($parameters);
$group->estates->offline($parameters);
$group->estates->get('estate-id');
$group->estates->setPublicUrl('estate-id', 'public-url');
```

#### Previews

[](#previews)

```
$group->previews->list($parameters);
```

#### Offices

[](#offices)

```
$group->offices->list();
```

#### Webhook

[](#webhook)

```
$group->webhook->set('webhook-url');
$group->webhook->unset();
```

#### Contact requests

[](#contact-requests)

```
$group->sendContactRequest($parameters);
$group->sendValuationRequest($parameters);
```

#### Tokens

[](#tokens)

```
$api->token->info();
$api->token->revoke();
```

### Pagination

[](#pagination)

Endpoints that retrieve multiple items return a traversable list of objects. Pagination for large lists happens automatically.

```
$estates = $group->estates->list();

// Traversing over the response takes care of pagination in the background
foreach ($estates as $estate) {
    echo $estate->name . PHP_EOL;
}
```

### Manual pagination

[](#manual-pagination)

For situations where manual pagination is required, a `page` method is provided. Calling this method with both a desired page index (starting at 1), and the amount of items to retrieve per page, returns a traversable list of objects. This list also provides multiple methods for dealing with paging metadata:

- `getPage()` to retrieve the current page index (starting at 1).
- `getPageSize()` to retrieve the maximum amount of items per page.
- `count()` to retrieve the actual amount of items on the current page.
- `getTotalCount()` to retrieve the total amount of items across all pages.
- `getPageCount()` to retrieve the total amount of pages.

#### Example

[](#example)

```
$page_index = 3;
$items_per_page = 20;

$estates = $group->estates->list([
    'updated_since' => new \DateTime('2026-01-01')
]);
$page = $estates->page($page_index, $items_per_page);

echo 'Showing ' . $page->count() . ' items out of ' . $page->getTotalCount() . PHP_EOL;
echo 'Page ' . $page->getPage() . ' of ' . $page->getPageCount() . PHP_EOL;
foreach ($page as $estate) {
    echo $estate->name . PHP_EOL;
}
```

### Configuration

[](#configuration)

The default base URL is `https://dev-api.mason.immo/`. It can be changed through the constructor:

```
$api = new Client(
    clientId: 'client-id',
    clientSecret: 'client-secret',
    baseUrl: 'https://api.example.com/',
);
```

The default page size is 25 and can be configured when creating the client:

```
$api = new Client(
    clientId: 'client-id',
    clientSecret: 'client-secret',
    defaultPageSize: 100,
);
```

### Token storage

[](#token-storage)

The client obtains new OAuth access tokens automatically when necessary. Tokens are kept in memory by default, though it is recommended to use persistent token storage instead.

To use persistent filesystem storage:

```
use Mason\Api\Auth\TokenStorage\FileTokenStorage;

$api = new Client(
    clientId: 'client-id',
    clientSecret: 'client-secret',
    tokenStorage: new FileTokenStorage('/secure/cache/mason-api'),
);
```

Native Redis storage requires the `ext-redis` PHP extension:

```
use Mason\Api\Auth\TokenStorage\RedisTokenStorage;

$redis = new Redis();
$redis->connect('127.0.0.1');

$api = new Client(
    clientId: 'client-id',
    clientSecret: 'client-secret',
    tokenStorage: new RedisTokenStorage($redis),
);
```

Any PSR-16 cache can be used with `Psr16TokenStorage`. Custom stores can implement `Mason\Api\Auth\TokenStorage\TokenStorageInterface`.

License
-------

[](#license)

`fw4/mason-api` is licensed under the MIT License (MIT). Please see [LICENSE](LICENSE) for more information.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

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

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2fe7a44c5e07cf8dd0eed2941b88dcab03342fb149ede5347b3467bc17691d4e?d=identicon)[Fyrts](/maintainers/Fyrts)

---

Top Contributors

[![fyrts](https://avatars.githubusercontent.com/u/5918336?v=4)](https://github.com/fyrts "fyrts (3 commits)")

---

Tags

apisdkmasonmason.immo

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/fw4-mason-api/health.svg)

```
[![Health](https://phpackages.com/badges/fw4-mason-api/health.svg)](https://phpackages.com/packages/fw4-mason-api)
```

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k17](/packages/tempest-framework)[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k543.5M2.7k](/packages/aws-aws-sdk-php)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

36789.4k2](/packages/telnyx-telnyx-php)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M606](/packages/shopware-core)[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

60316.0M89](/packages/mollie-mollie-api-php)

PHPackages © 2026

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