Installation

The PHP SDK is hosted on composer (here).

$composer require schematichq/schematic-php

Initialization

Initialize a client with an API key secret.

1use Schematic\Schematic;
2
3$schematic = new Schematic($apiKey, ['basePath' => $apiUrl]);

Usage example

Once the client is initialized, you may use the SDK to make requests. Below is an example of creating a table for all companies stored in Schematic.

1<?php
2try {
3 $schematic = new Schematic($apiKey, ['basePath' => $apiUrl]);
4
5 $response = $schematic->CompaniesApi->listCompanies();
6 $companies = $response->getData();
7} catch (\Exception $e) {
8 report($e);
9}?>
10
11<table>
12 <thead>
13 <tr>
14 <th>Company ID</th>
15 <th>Company Name</th>
16 </tr>
17 </thead>
18 <tbody>
19 <?php foreach ($companies as $company): ?>
20 <tr>
21 <td><?php echo $company->getId(); ?></td>
22 <td><?php echo $company->getName(); ?></td>
23 </tr>
24 <?php endforeach; ?>
25 </tbody>
26</table>
Built with