PHPackages                             tombroucke/twenty-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. tombroucke/twenty-api

ActiveLibrary[API Development](/categories/api)

tombroucke/twenty-api
=====================

REST API connector for twenty CRM

1.1.1(1y ago)18PHP

Since Jul 2Pushed 1y agoCompare

[ Source](https://github.com/tombroucke/twenty-api)[ Packagist](https://packagist.org/packages/tombroucke/twenty-api)[ RSS](/packages/tombroucke-twenty-api/feed)WikiDiscussions main Synced today

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

Twenty API
==========

[](#twenty-api)

Install
-------

[](#install)

```
composer require tombroucke/twenty-api
```

### Usage

[](#usage)

This library is based on [Fansipan](https://phanxipang.github.io/fansipan/).

There are a variety of convenient methods to inspect the response.

```
$response->body(): string;
$response->data(): array;
$response->status(): int;
$response->ok(): bool;
$response->successful(): bool;
$response->failed(): bool;
$response->header(string $header): ?string;
$response->headers(): array;
// and more...
```

### Requests

[](#requests)

There are currently 6 types of requests: `CreateManyObjectsRequest`, `CreateObjectRequest`, `DeleteObjectRequest`, `FindManyObjectsRequest`, `FindObjectRequest` and `UpdateObjectRequest`.

As a convention, the **first argument** of the constructor is always the **object's API Name**.

In requests to endpoints for single objects, the **next argument** is the **object ID**. In POST requests (`CreateManyObjectsRequest`, `CreateObjectRequest`, `UpdateObjectRequest`), the **next argument** is the **post body**. The **next arguments** can be query parameters. For readability, you can use named arguments.

```
new \Otomaties\Twenty\FindManyObjectsRequest(
    objectApiName: 'people',
    filter: 'companyId[eq]:12345678-ab12-12a3-12a3-a12b4c5678d9',
    startingAfter: 'eyJpZCI7GgHqLsjkE8A7RTblNGYaNDhhMy87ZqhePDOJB8VxZGFiZGIxMyJ7'
)
```

Examples
--------

[](#examples)

### Find Many Objects

[](#find-many-objects)

```
