PHPackages                             gentics/mesh-php-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. gentics/mesh-php-client

ActiveLibrary[API Development](/categories/api)

gentics/mesh-php-client
=======================

Gentics Mesh PHP Client Library

0.20.6(5d ago)314.5k↓63.3%2[1 issues](https://github.com/gentics/mesh-php-client/issues)[3 PRs](https://github.com/gentics/mesh-php-client/pulls)Apache-2.0PHPPHP ^8.1

Since Aug 31Pushed 5d ago12 watchersCompare

[ Source](https://github.com/gentics/mesh-php-client)[ Packagist](https://packagist.org/packages/gentics/mesh-php-client)[ RSS](/packages/gentics-mesh-php-client/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (16)Versions (30)Used By (0)

Gentics Mesh PHP Client
=======================

[](#gentics-mesh-php-client)

> PHP Client implementation for [Gentics Mesh REST API](https://getmesh.io/docs/beta/raml).

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

[](#installation)

```
composer require gentics/mesh-php-client
```

Basic usage
-----------

[](#basic-usage)

```
use Gentics\Mesh\Client\MeshClient;

require_once __DIR__ . '/vendor/autoload.php';

$client = new MeshClient("http://localhost:8080/api/v1");

// Load user info (sync)
$request = $client->me();
$response = $request->send();
echo $response->getBody();

// Load user info (async)
$promise = $request->sendAsync();
$promise->then(function ($response) {
  echo 'I completed! ' . $response->getBody();
});
$promise->wait();

// Load users and apply paging
$request = $client->findUsers(["perPage" => 1]);
$response = $request->send();
echo $response->getBody();
```

Authentication
--------------

[](#authentication)

```
$client = new MeshClient("http://localhost:8080/api/v1");

// You can either login and use the build-in cookie handling
// Keep in mind that your cookie will not be automatically refreshed.
// Any authenticated request will refresh the cookie and keep you authenticated.
$client->login("admin", "admin")->wait();

// Or use a dedicated API key which will never expire
// You can use the mesh-cli to generate a key
// Setting the API key will invalidate any previously set login token information
$client->setAPIKey("eyJ0eXAiOiJKV1QiLC … ZYYJbD8HllF6XZT0xRTxr3i4b9PY");
```

GraphQL Example
---------------

[](#graphql-example)

```
$client = new MeshClient("http://localhost:8080/api/v1");
$query = [
    "query" => "{users{elements{uuid, username}}}"
];
$request = $client->graphQL("demo", $query);
$response = $request->send();
$json = $response->toJson();
$this->assertEquals("anonymous", $json->data->users->elements[0]->username);
```

WebRoot Example
---------------

[](#webroot-example)

With webroot you can fetch any node which contains a `segment` field in the schema. The webroot endpoint is also able to directly return binary data.

```
$client = new MeshClient("http://localhost:8888/api/v1");
$request = $client->webroot("demo", "/images/yacht-pelorus.jpg");
$response = $request->send();
// You can check whether the webroot response returns json or otherwise binary data (e.g. image data)
$response->isJson();
```

CRUD Example
------------

[](#crud-example)

```
$client = new MeshClient("http://localhost:8080/api/v1");
$client->login("admin", "admin")->wait();

// 1. Create User
$request = [
  "username" => "guzzle",
    "password" => "geheim",
];
$uuid = "5725992507e748a1a5992507e7f8a115";
$userResp = $client->createUserWithUuid($uuid, $request)->send()->toJson();

// 2. Read user
$user = $client->findUserByUuid($uuid)->send()->toJson();

// 3. Update user
$user->username = "hugo";
$updated = $client->updateUser($uuid, $user)->send()->toJson();

// 4. Delete user
$client->deleteUser($uuid)->send();
```

Error Handling
--------------

[](#error-handling)

By default exceptions will be thrown if the request fails (e.g. 4xx, 5xx error code).

```
try {
  $uuid = "5725992507e748a1a5992507e7f8a115";
  $client->deleteUser($uuid)->send();
} catch (ClientException $e) {
    // Error could indicate a 404
    $response = $e->getResponse();
    echo $response->getBody()->getContents();
}
```

Configuration
-------------

[](#configuration)

It is possible to configure the underlying Guzzle client:

```
// Change the default error behaviour to not throw error exceptions
$config = ['http_errors' => false];
$client = new MeshClient("http://localhost:8080/api/v1", $config);
```

Compatibility
-------------

[](#compatibility)

- Gentics Mesh 1.8.x
- PHP 8.1+

TODOs
=====

[](#todos)

- Implement full upload support
- Implement eventbus websocket support

Release
-------

[](#release)

**maintenance-0.10.x branch**Versioning: 0.10.x - PHP 7.x, Guzzle 6

**master branch**Versioning: 0.20.x - PHP 8.1+, Guzzle 7

License
-------

[](#license)

[Apache License Version 2.0](http://www.apache.org/licenses/)

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance93

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 50.8% 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 ~178 days

Recently: every ~260 days

Total

17

Last Release

5d ago

PHP version history (2 changes)0.1PHP &gt;=7.0

0.8PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/d88b8821b2345b9b7f50b7a789dd386ff31b6dcd810ebe3bc30c27bcbfe75a72?d=identicon)[gentics](/maintainers/gentics)

![](https://avatars.githubusercontent.com/u/326605?v=4)[Johannes Schüth](/maintainers/Jotschi)[@Jotschi](https://github.com/Jotschi)

![](https://avatars.githubusercontent.com/u/5785908?v=4)[Bernhard Riegler](/maintainers/bernhardriegler)[@bernhardriegler](https://github.com/bernhardriegler)

---

Top Contributors

[![netwarex](https://avatars.githubusercontent.com/u/6048614?v=4)](https://github.com/netwarex "netwarex (30 commits)")[![Abyhsen](https://avatars.githubusercontent.com/u/13579173?v=4)](https://github.com/Abyhsen "Abyhsen (10 commits)")[![yrucrem](https://avatars.githubusercontent.com/u/12695328?v=4)](https://github.com/yrucrem "yrucrem (8 commits)")[![bernhardriegler](https://avatars.githubusercontent.com/u/5785908?v=4)](https://github.com/bernhardriegler "bernhardriegler (3 commits)")[![Jotschi](https://avatars.githubusercontent.com/u/326605?v=4)](https://github.com/Jotschi "Jotschi (2 commits)")[![KriszTuri](https://avatars.githubusercontent.com/u/72446693?v=4)](https://github.com/KriszTuri "KriszTuri (2 commits)")[![berni2288](https://avatars.githubusercontent.com/u/1029328?v=4)](https://github.com/berni2288 "berni2288 (2 commits)")[![kovesdieszter](https://avatars.githubusercontent.com/u/88904589?v=4)](https://github.com/kovesdieszter "kovesdieszter (1 commits)")[![npomaroli](https://avatars.githubusercontent.com/u/326709?v=4)](https://github.com/npomaroli "npomaroli (1 commits)")

---

Tags

gentics-meshphp-clientsdkmeshrest-client

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/gentics-mesh-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/gentics-mesh-php-client/health.svg)](https://phpackages.com/packages/gentics-mesh-php-client)
```

###  Alternatives

[aws/aws-sdk-php

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

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[facebook/php-business-sdk

PHP SDK for Facebook Business

91624.2M37](/packages/facebook-php-business-sdk)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M47](/packages/tencentcloud-tencentcloud-sdk-php)[facebook/php-ads-sdk

PHP SDK for Facebook Business

9214.2M8](/packages/facebook-php-ads-sdk)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[resend/resend-php

Resend PHP library.

617.2M43](/packages/resend-resend-php)

PHPackages © 2026

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