---
title: "PHP"
description: "Connect your PHP apps to Gitana with our flexible open-source driver, enabling easy API integration and content management. (Gitana 4.0)"
product: "Gitana"
version: "4.0"
url: "/documentation/gitana/4.0/developers/drivers/php"
---

# PHP

Connect your PHP applications to Gitana

| Latest Version |  |
| --- | --- |
| Version | 1.1.2 |
| Date | Tue Jan 04 2022 21:21:06 GMT+0000 (Coordinated Universal Time) |
| GitHub | [https://github.com/gitana/cloudcms-php-driver](https://github.com/gitana/cloudcms-php-driver "https://github.com/gitana/cloudcms-php-driver") |
| Packagist | [https://packagist.org/packages/cloudcms/cloudcms#1.1.2](https://packagist.org/packages/cloudcms/cloudcms#1.1.2 "https://packagist.org/packages/cloudcms/cloudcms#1.1.2") |

![PHP](/documentation/gitana/4.0/developers/drivers/php/php.svg)

The Gitana PHP driver is a client library used to facilitate connections to the Gitana API. The driver handles OAuth authentication and token management, HTTPS calls, and provides convenient methods and classes with which to perform content operations. It works against Gitana instances on our SaaS platform as well as on-premise installations.

## Installation

To install, run:

```
composer require cloudcms/cloudcms
```

## Examples

Below are some examples of how you might use this driver:

```php
use CloudCMS\CloudCMS;

// Load configuration from gitana.json file
$config_string = file_get_contents("gitana.json");
$config = json_decode($config_string, true);

// Connect to CloudCMS
$client = new CloudCMS();
$platform = $client->connect($config);

// List Repositories
$repositories => $platform->listRepositories();

// Read Repository
$repository = $platform->readRepository("<repositoryId>");

// List Branches
$branches = $repository->listBranches();

// Read Branch
$branch = $repository->readBranch("<branchId>");

// Read Node
$node = $branch->readNode("<nodeId>");

// Create Node
$obj = array(
"title" => "Twelfth Night",
"description" => "An old play"
);
$newNode = $branch->createNode($obj);

// Query Nodes
$query = array(
"_type" => "store:book"
);
$pagination = array(
"limit" => 2
);
$queriedNodes = $branch->queryNodes($query, $pagination);

// Find Nodes
$find = array(
"search" => "Shakespeare",
"query" => array(
"_type" => "store:book"
)
);
$foundNodes = $branch->findNodes($find);
```

## Documentation

The PHP driver is a useful library that provides access to the capabilities of Gitana from a programmatic perspective. It is therefore important to first familiarize yourself with the concepts presented in the [Gitana Documentation](/documentation.html "Gitana Documentation").

## Fork the Code

The Cloud CMS PHP driver is 100% open-source (Apache 2.0) and so you're free to fork it, extend it and dig into it to learn about how it works.

- [View the Source Code](https://github.com/gitana/cloudcms-php-driver "View the Source Code")

## Bugs / Problems

If you run into a bug, please [create an issue](https://github.com/gitana/cloudcms-php-driver/issues "create an issue") so that we can look at it.

For production support, please contact us at [support@gitana.io](mailto:support@gitana.io "support@gitana.io") or call us directly.

## Support and Terms of Use

The PHP driver is free to use in your applications and projects. It is fully supported by Gitana.
