---
title: PHP
summary: Install the PHP SDK, the bimbase/bimworks Composer package, from the private registry, and check that it logs in.
order: 40
languages: [php]
terms: [sdk, api-token]
see-also: [how-to/install/java, how-to/auth/log-in-with-an-api-token, tutorials/php/quick-start, reference/sdk/php, api]
notion: https://www.notion.so/bimbase/PHP-Composer-2e1e41afde7f80c7bc43ccca8d92bf21
---

# PHP

For PHP developers. The PHP [[term:sdk|SDK]] is one of the OpenAPI SDKs ([[page:reference/sdk]]): it is generated from the [[page:api|OpenAPI document]], so it covers the operations of the OpenAPI (login and tokens, the account, the tree, uploads and downloads, queries, checks, model comparison, transactions, actions, workspaces, linked data, geo references, CityGML and 3D Tiles, renders, text to action) and talks plain HTTPS through Guzzle. See [[page:reference/sdk/php]] for the classes and [[page:tutorials/php/quick-start]] for a first script.

## Before you start

- PHP **8.1 or newer** with the `curl`, `json` and `mbstring` extensions.
- Composer.
- Credentials for the private registry `https://composer.bim.works`. Your company portal has them, or ask support@bimbase.nl.

## 1. Register the repository

Add the registry to `composer.json`:

```json {#repositories}
"repositories": [
  {
    "type": "composer",
    "url": "https://composer.bim.works"
  }
]
```

## 2. Store the credentials

Create `auth.json` next to `composer.json` (or in `~/.composer/`), and keep it out of version control:

```json {#auth-json}
{
  "http-basic": {
    "composer.bim.works": {
      "username": "[your username]",
      "password": "[your password]"
    }
  }
}
```

## 3. Require the package

Use the version that matches your BIM.works server (the version pill at the top of this page is the server's):

```json {#require}
"require": {
  "bimbase/bimworks": "3.0.0-beta.192"
}
```

Then run `composer install` (or `composer update bimbase/bimworks`). The package autoloads the `BIMworks\` namespace: API classes live in `BIMworks\Api`, one per tag of the document (`AuthApi`, `FsApi`, `ModelApi`, `IFCApi`, `GISApi`, … [[page:reference/sdk/php#classes|all of them]]) and request and response models in `BIMworks\Model`.

## Check

Save the program below as `check.php` next to `composer.json`, put in your address and [[term:api-token|API token]], and run `php check.php`. It connects to your instance's OpenAPI root (the application address plus `/openapi`), logs in, and asks for the root node of that token. Every example of the PHP SDK has these four steps ([[page:reference/sdk/php#example-shape]]).

```sdk-example {#check}
operation: GetRootNodeUuid
languages: php
```

It prints a UUID. The two calls are `AuthApi::loginWithApiToken` and `FsApi::getRootNodeUuid` in [[page:reference/sdk/php]], the operations behind them [[openapi:LoginWithApiToken]] and [[openapi:GetRootNodeUuid]]. Next: [[page:how-to/auth/log-in-with-an-api-token]].
