PHPackages                             drnio/directus-v8-manager - 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. drnio/directus-v8-manager

ActiveLibrary[API Development](/categories/api)

drnio/directus-v8-manager
=========================

A PHP client for interacting with the \*\*Directus v8 API\*\*. This package provides easy-to-use methods for performing \*\*CRUD operations\*\*, managing Directus collections, and handling \*\*authentication\*\*, making it simple to integrate Directus into your PHP applications.

v6.6.0(6mo ago)115MITPHPPHP ^7.4|^8.0

Since Mar 30Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/Dr-Nio/directus-v8-manager)[ Packagist](https://packagist.org/packages/drnio/directus-v8-manager)[ RSS](/packages/drnio-directus-v8-manager/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (21)Used By (0)

Directus v8 Manager (drnio/directus-v8-manager)
===============================================

[](#directus-v8-manager-drniodirectus-v8-manager)

A lightweight PHP client for interacting with the **Directus v8 API**. This package provides convenient helpers for authentication, token management, and CRUD operations.

---

Quick Links
-----------

[](#quick-links)

- Repository: [Dr-Nio/directus-v8-manager](https://github.com/Dr-Nio/directus-v8-manager)
- License: MIT

---

Features
--------

[](#features)

- User authentication (login, logout, token refresh)
- CRUD operations for collections and items
- Pagination support for large datasets
- Error handling via exceptions and structured responses
- Token management (access and refresh tokens)

---

Requirements
------------

[](#requirements)

- PHP 7.4+
- Composer
- Running Directus v8 instance

---

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

[](#installation)

```
composer require drnio/directus-v8-manager
```

---

Environment Setup
-----------------

[](#environment-setup)

```
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();

$baseUrl = getenv('DIRECTUS_BASE_URL');
$email = getenv('DIRECTUS_EMAIL');
$password = getenv('DIRECTUS_PASSWORD');
```

---

Classes Documentation
---------------------

[](#classes-documentation)

### 1. DirectusAuth

[](#1-directusauth)

Handles authentication and token management.

#### Methods:

[](#methods)

- `__construct($baseUrl, $email, $password)` — Initialize with API base URL and user credentials.
- `authenticate()` — Authenticate the user and return access token.
- `refreshToken()` — Refresh access token using refresh token.
- `logout()` — Invalidate current token and logout.

#### Usage Example:

[](#usage-example)

```
use Drnio\DirectusV8Manager\DirectusAuth;

$auth = new DirectusAuth($baseUrl, $email, $password);
$token = $auth->authenticate();
$newToken = $auth->refreshToken();
$auth->logout();

// Create new user
$newUser = $directus->createUser([
  'email' => 'newuser@example.com',
  'password' => 'pass1234',
  'role' => 'viewer'
]);

// Get a user
$user = $directus->getUserById(12);

// Get a user by email
$user = $directus->getUserByEmail('email@domail.com');

// Update user
$updated = $directus->updateUser(12, ['first_name' => 'John', 'last_name' => 'Doe']);

// Delete user
$directus->deleteUser(12);
```

### 2. DirectusClient

[](#2-directusclient)

Provides CRUD operations for Directus collections/items.

#### Methods:

[](#methods-1)

- `__construct($baseUrl, $accessToken)` — Initialize client with base URL and token.
- `items($collectionName)` — Returns a helper object for collection operations.
    - `get($params = [])` — Retrieve items with optional parameters.
    - `create($data)` — Create a new item in the collection.
    - `update($id, $data)` — Update an item by ID.
    - `delete($id)` — Delete an item by ID.
    - `paginate($params = [])` — Iterate over items page by page.

#### Usage Example:

[](#usage-example-1)

```
use Drnio\DirectusV8Manager\DirectusClient;

$client = new DirectusClient($baseUrl, $token);

// Retrieve items
$items = $client->items('articles')->get(['limit' => 50]);

// Create item
$newItem = $client->items('articles')->create(['title' => 'Hello', 'body' => 'World']);

// Update item
$updatedItem = $client->items('articles')->update($itemId, ['title' => 'Updated']);

// Delete item
$client->items('articles')->delete($itemId);

// Pagination example
foreach ($client->items('articles')->paginate(['limit' => 100]) as $page) {
    foreach ($page['data'] as $row) {
        // Process each row
    }
}
```

---

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

[](#error-handling)

Wrap API calls with try/catch:

```
try {
    $items = $client->items('articles')->get();
} catch (\Exception $e) {
    error_log($e->getMessage());
}
```

---

Contributing
------------

[](#contributing)

1. Fork repository
2. Create feature branch
3. Add tests and documentation
4. Open Pull Request

Follow PSR-12 / PSR-4 coding standards.

---

License
-------

[](#license)

MIT © Dr-Nio

---

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance66

Regular maintenance activity

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~10 days

Recently: every ~0 days

Total

20

Last Release

208d ago

Major Versions

v1.0.0 → v2.1.02025-10-11

v2.1.0 → v3.0.02025-10-11

v3.3.0 → v4.0.02025-10-11

v4.1.1 → v5.0.02025-10-11

v5.0.0 → 6.0.02025-10-11

PHP version history (2 changes)v1.1.0PHP ^7.4|^8.0

3.1.0PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/a0e4cf133aedae23aab8eb49981c47e7ec156a7affa81ff7ae8781c933fb705d?d=identicon)[Dr-Nio](/maintainers/Dr-Nio)

---

Top Contributors

[![Dr-Nio](https://avatars.githubusercontent.com/u/38550162?v=4)](https://github.com/Dr-Nio "Dr-Nio (26 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/drnio-directus-v8-manager/health.svg)

```
[![Health](https://phpackages.com/badges/drnio-directus-v8-manager/health.svg)](https://phpackages.com/packages/drnio-directus-v8-manager)
```

###  Alternatives

[get-stream/stream

A PHP client for Stream (https://getstream.io)

1451.3M8](/packages/get-stream-stream)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[agence104/livekit-server-sdk

Server-side SDK for LiveKit.

79189.9k1](/packages/agence104-livekit-server-sdk)[packbackbooks/lti-1p3-tool

A library used for building IMS-certified LTI 1.3 tool providers in PHP.

51438.3k2](/packages/packbackbooks-lti-1p3-tool)[tamara-solution/php-sdk

Tamara PHP Client Library

10259.4k1](/packages/tamara-solution-php-sdk)[revolution/laravel-bluesky

Bluesky(AT Protocol) for Laravel

4317.3k](/packages/revolution-laravel-bluesky)

PHPackages © 2026

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