PHPackages                             wmbh/laravel-fibery - 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. wmbh/laravel-fibery

ActiveLibrary[API Development](/categories/api)

wmbh/laravel-fibery
===================

A Laravel package for interacting with the Fibery API

v1.2.0(2mo ago)045↑100%[2 issues](https://github.com/WMBH/laravel-fibery/issues)MITPHPPHP ^8.2CI passing

Since Feb 4Pushed 1mo agoCompare

[ Source](https://github.com/WMBH/laravel-fibery)[ Packagist](https://packagist.org/packages/wmbh/laravel-fibery)[ Docs](https://github.com/wmbh/laravel-fibery)[ GitHub Sponsors](https://github.com/:vendor_name)[ RSS](/packages/wmbh-laravel-fibery/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (28)Versions (5)Used By (0)

Laravel Fibery
==============

[](#laravel-fibery)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a480a81a3b883ff02c9a531851e24f8bccb2581f5c1a4ec2f71a898f654958e5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776d62682f6c61726176656c2d6669626572792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wmbh/laravel-fibery)[![GitHub Tests Action Status](https://camo.githubusercontent.com/76c532dfc817783f234009679bfd168eae867454170cf487d5c822c15899dba6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f776d62682f6c61726176656c2d6669626572792f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/wmbh/laravel-fibery/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/44fb637419a9a742a883e4e93def475945526fefab883161ff03babcd377c1f0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f776d62682f6c61726176656c2d6669626572792f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/wmbh/laravel-fibery/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/f62441707ce417531c6d9e7995f819ddac18cf69bba80b1fc66f816a4f5b21b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f776d62682f6c61726176656c2d6669626572792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wmbh/laravel-fibery)

A Laravel package for interacting with the [Fibery](https://fibery.io) API. Provides a fluent query builder, entity management, and full API coverage for Schema, Types, Fields, Files, and Documents.

Quick Start
-----------

[](#quick-start)

```
use WMBH\Fibery\Facades\Fibery;

// Query entities
$tasks = Fibery::query('Project/Task')
    ->select(['fibery/id', 'fibery/name', 'Project/Status'])
    ->where('Project/Status', 'Active')
    ->limit(10)
    ->get();

// Create entity
$task = Fibery::create('Project/Task', [
    'fibery/name' => 'New Task',
]);

// Update entity
Fibery::update('Project/Task', $task['fibery/id'], [
    'fibery/name' => 'Updated Task',
]);
```

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

[](#installation)

Install the package via Composer:

```
composer require wmbh/laravel-fibery
```

Publish the configuration file:

```
php artisan vendor:publish --tag="fibery-config"
```

Configuration
-------------

[](#configuration)

Add these environment variables to your `.env` file:

```
FIBERY_WORKSPACE=your-workspace
FIBERY_TOKEN=your-api-token
FIBERY_TIMEOUT=30
```

**FIBERY\_WORKSPACE** is your workspace subdomain. For example:

- If your Fibery URL is `https://mycompany.fibery.io` → workspace is `mycompany`
- If your Fibery URL is `https://acme-corp.fibery.io` → workspace is `acme-corp`

Get your API token from Fibery: **Settings &gt; API Tokens &gt; Create Token**

The configuration file (`config/fibery.php`) contains:

```
return [
    'workspace' => env('FIBERY_WORKSPACE'),
    'token' => env('FIBERY_TOKEN'),
    'timeout' => env('FIBERY_TIMEOUT', 30),
    'retry' => [
        'times' => env('FIBERY_RETRY_TIMES', 3),
        'sleep' => env('FIBERY_RETRY_SLEEP', 1000), // milliseconds
    ],
];
```

Testing Connection
------------------

[](#testing-connection)

Verify your configuration with the artisan command:

```
php artisan fibery:test
```

Usage
-----

[](#usage)

### Query Builder

[](#query-builder)

The query builder provides a fluent interface for querying Fibery entities:

```
use WMBH\Fibery\Facades\Fibery;

// Basic query
$tasks = Fibery::query('Project/Task')
    ->select(['fibery/id', 'fibery/name', 'Project/Status'])
    ->where('Project/Status', 'Active')
    ->orderBy('fibery/creation-date', 'desc')
    ->limit(10)
    ->get();

// Get first result
$task = Fibery::query('Project/Task')
    ->select(['fibery/id', 'fibery/name'])
    ->where('fibery/public-id', 'TASK-123')
    ->first();

// Check existence
$exists = Fibery::query('Project/Task')
    ->where('fibery/name', 'My Task')
    ->exists();

// Count results
$count = Fibery::query('Project/Task')
    ->where('Project/Status', 'Active')
    ->count();
```

### Where Clauses

[](#where-clauses)

```
// Equals (shorthand)
->where('Project/Status', 'Active')

// With operator
->where('Project/Priority', '>', 5)
->where('Project/DueDate', '', 3)

// OR conditions
->orWhere([
    ['Project/Status', '=', 'Active'],
    ['Project/Priority', '>', 5],
])
```

### Relationships

[](#relationships)

```
// Include related entity fields
$tasks = Fibery::query('Project/Task')
    ->select(['fibery/id', 'fibery/name'])
    ->with('Project/Assignee', ['fibery/id', 'fibery/name', 'user/email'])
    ->get();

// Include collection with subquery
$tasks = Fibery::query('Project/Task')
    ->select(['fibery/id', 'fibery/name'])
    ->with('Project/Tags', function ($query) {
        $query->select(['fibery/id', 'Project/name'])
              ->limit(5);
    })
    ->get();

// Aggregates
$projects = Fibery::query('Project/Project')
    ->select(['fibery/id', 'fibery/name'])
    ->withCount('task_count', ['Project/Tasks', 'fibery/id'])
    ->get();
```

### Pagination

[](#pagination)

```
$tasks = Fibery::query('Project/Task')
    ->select(['fibery/id', 'fibery/name'])
    ->limit(10)
    ->offset(20)  // Skip first 20
    ->get();

// Aliases
->take(10)
->skip(20)

// Get all results (use carefully)
->noLimit()
```

### Entity Operations

[](#entity-operations)

```
// Create - returns the created entity with its fibery/id (UUID)
$task = Fibery::create('Project/Task', [
    'fibery/name' => 'New Task',
    'Project/Priority' => 5,
    // For relations, pass an object with fibery/id of the related entity
    'Project/Status' => ['fibery/id' => '123e4567-e89b-12d3-a456-426614174000'],
]);
// $task['fibery/id'] contains the UUID of the created entity

// Update - pass the entity UUID (fibery/id), NOT the public ID
Fibery::update('Project/Task', '123e4567-e89b-12d3-a456-426614174000', [
    'fibery/name' => 'Updated Task Name',
    'Project/Priority' => 10,
]);

// Delete - pass the entity UUID (fibery/id)
Fibery::delete('Project/Task', '123e4567-e89b-12d3-a456-426614174000');

// Find by UUID (fibery/id) - the internal unique identifier
$task = Fibery::find('Project/Task', '123e4567-e89b-12d3-a456-426614174000');

// Find by Public ID (fibery/public-id) - the human-readable ID like "TASK-123"
$task = Fibery::findByPublicId('Project/Task', 'TASK-123');

// Create or Update (upsert) - useful for syncing external data
Fibery::entity()->createOrUpdate('Project/Task', [
    'fibery/name' => 'Task Name',
    'Project/ExternalId' => 'ext-123',
], ['Project/ExternalId']); // Field to check for duplicates
```

> **Note on IDs:** Fibery uses two types of IDs:
>
> - `fibery/id` - UUID like `123e4567-e89b-12d3-a456-426614174000` (used for API operations)
> - `fibery/public-id` - Human-readable like `TASK-123` (shown in UI)

### Collection Operations

[](#collection-operations)

```
// All collection operations use fibery/id (UUIDs)

// Add tags to a task - pass entity UUID and array of tag UUIDs
Fibery::addToCollection(
    'Project/Task',                              // Type name
    '123e4567-e89b-12d3-a456-426614174000',     // Task's fibery/id
    'Project/Tags',                              // Collection field name
    ['abc-uuid-1', 'def-uuid-2']                 // Tag fibery/ids to add
);

// Remove items from collection
Fibery::removeFromCollection('Project/Task', 'task-uuid', 'Project/Tags', ['tag-uuid-1']);

// Replace all collection items (removes existing, adds new)
Fibery::setCollection('Project/Task', 'task-uuid', 'Project/Tags', ['tag-uuid-3']);

// Clear all items from collection
Fibery::clearCollection('Project/Task', 'task-uuid', 'Project/Tags');
```

### Batch Operations

[](#batch-operations)

```
// Create multiple entities
Fibery::entity()->createMany('Project/Task', [
    ['fibery/name' => 'Task 1'],
    ['fibery/name' => 'Task 2'],
    ['fibery/name' => 'Task 3'],
]);

// Update multiple entities
Fibery::entity()->updateMany('Project/Task', [
    ['fibery/id' => 'uuid-1', 'Project/Status' => ['fibery/id' => 'done-uuid']],
    ['fibery/id' => 'uuid-2', 'Project/Status' => ['fibery/id' => 'done-uuid']],
]);

// Delete multiple entities
Fibery::entity()->deleteMany('Project/Task', ['uuid-1', 'uuid-2', 'uuid-3']);
```

### Schema API

[](#schema-api)

```
// Get full schema
$schema = Fibery::schema()->getSchema();

// Get all types (databases)
$types = Fibery::schema()->getTypes();

// Get specific type
$taskType = Fibery::schema()->getType('Project/Task');

// Get fields for a type
$fields = Fibery::schema()->getFields('Project/Task');

// Get all spaces
$spaces = Fibery::schema()->getSpaces();

// Get types in a space
$projectTypes = Fibery::schema()->getTypesInSpace('Project');

// Check if type exists
if (Fibery::schema()->typeExists('Project/Task')) {
    // ...
}
```

### Type API (Database Management)

[](#type-api-database-management)

```
// Create a new database
Fibery::types()->create('Project', 'Feature');

// Rename a database
Fibery::types()->rename('Project/Feature', 'Project/Enhancement');

// Delete a database
Fibery::types()->delete('Project/Enhancement');
```

### Field API

[](#field-api)

```
// Create fields
Fibery::fields()->createTextField('Project/Task', 'Project/Notes');
Fibery::fields()->createNumberField('Project/Task', 'Project/StoryPoints');
Fibery::fields()->createDateField('Project/Task', 'Project/DueDate');
Fibery::fields()->createCheckboxField('Project/Task', 'Project/IsBlocked');

// Create single-select field
Fibery::fields()->createSingleSelectField('Project/Task', 'Project/Priority', [
    'Low', 'Medium', 'High', 'Critical'
]);

// Create relation field
Fibery::fields()->createRelationField('Project/Task', 'Project/Assignee', 'fibery/user');

// Rename field
Fibery::fields()->rename('Project/Task', 'Project/Notes', 'Project/Description');

// Delete field
Fibery::fields()->delete('Project/Task', 'Project/OldField');
```

### File API

[](#file-api)

```
// Upload a file
$file = Fibery::files()->upload('/path/to/file.pdf');

// Upload from content
$file = Fibery::files()->uploadContent($content, 'document.pdf');

// Download a file
$content = Fibery::files()->download('file-secret');

// Download to path (throws FiberyException on write failure)
Fibery::files()->downloadTo('file-secret', '/path/to/save.pdf');

// Attach file to entity
Fibery::files()->attachToEntity('Project/Task', 'task-uuid', 'Files/Files', $file['fibery/id']);
```

### Document API (Rich Text)

[](#document-api-rich-text)

```
// Get document content
$content = Fibery::documents()->getContent('document-secret');

// Update document content
Fibery::documents()->updateContent('document-secret', [
    'content' => [
        'doc' => [
            'type' => 'doc',
            'content' => [/* ProseMirror content */]
        ]
    ]
]);

// Set markdown content
Fibery::documents()->setMarkdown('document-secret', '# Hello World');
```

### Webhooks

[](#webhooks)

Use webhooks to receive notifications when entities change in Fibery.

```
// Create a webhook for a type
$webhook = Fibery::webhooks()->create('https://your-endpoint.com/webhook', 'Space/Task');
// Returns: ['id' => 5, 'url' => '...', 'type' => 'Space/Task', 'state' => 'active', ...]

// List all webhooks
$webhooks = Fibery::webhooks()->all();

// Get a webhook by ID
$webhook = Fibery::webhooks()->get(5);

// Delete a webhook
Fibery::webhooks()->delete(5);

// Get webhooks filtered by type
$webhooks = Fibery::webhooks()->getByType('Space/Task');

// Check if a webhook exists
if (Fibery::webhooks()->exists(5)) {
    // ...
}
```

> **Note:** Only Fibery Admins can configure webhooks. Rich text field changes are not supported.

### Raw Commands

[](#raw-commands)

```
// Execute raw command
$result = Fibery::command('fibery.entity/query', [
    'query' => [
        'q/from' => 'Project/Task',
        'q/select' => ['fibery/id'],
        'q/limit' => 10,
    ],
]);

// Batch commands
$results = Fibery::batch([
    ['command' => 'fibery.entity/create', 'args' => [...]],
    ['command' => 'fibery.entity/create', 'args' => [...]],
]);
```

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

[](#error-handling)

The package provides a hierarchy of exceptions for granular error handling:

```
use WMBH\Fibery\Exceptions\FiberyException;
use WMBH\Fibery\Exceptions\AuthenticationException;
use WMBH\Fibery\Exceptions\RateLimitException;
use WMBH\Fibery\Exceptions\ConnectionException;
use WMBH\Fibery\Exceptions\TimeoutException;

try {
    $tasks = Fibery::query('Project/Task')->get();
} catch (AuthenticationException $e) {
    // Invalid or missing token (HTTP 401)
} catch (RateLimitException $e) {
    // Rate limit exceeded after all retries (HTTP 429)
    $retryAfter = $e->getRetryAfter(); // seconds from Retry-After header
} catch (TimeoutException $e) {
    // Request timed out (extends ConnectionException)
} catch (ConnectionException $e) {
    // Network error: DNS failure, connection refused, etc.
} catch (FiberyException $e) {
    // General API error
    $response = $e->getResponse(); // full API response data
    $statusCode = $e->getCode();   // HTTP status code
}
```

**Exception hierarchy:**

```
FiberyException (base)
├── AuthenticationException (401)
├── RateLimitException (429)
├── ValidationException (422)
├── ConnectionException (network errors)
│   └── TimeoutException (request timeouts)

```

All exceptions extend `FiberyException`, so catching `FiberyException` catches everything. Use specific exception types for targeted error handling.

Rate Limits
-----------

[](#rate-limits)

Fibery enforces rate limits:

- 3 requests per second per token
- 7 requests per second per workspace

The package automatically retries on 429 responses (configurable via `retry.times` and `retry.sleep`). When retries are exhausted, a `RateLimitException` is thrown with the `Retry-After` value from the API response.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [WMBH](https://github.com/wmbh)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance88

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% 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 ~14 days

Total

3

Last Release

76d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/06a643473c90d95f4d707e0e6c461a6e9eeeb1a9769055932fea6a14fa9b0737?d=identicon)[WMBH](/maintainers/WMBH)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (378 commits)")[![mvdnbrk](https://avatars.githubusercontent.com/u/802681?v=4)](https://github.com/mvdnbrk "mvdnbrk (46 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (31 commits)")[![Nielsvanpach](https://avatars.githubusercontent.com/u/10651054?v=4)](https://github.com/Nielsvanpach "Nielsvanpach (23 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (20 commits)")[![pforret](https://avatars.githubusercontent.com/u/474312?v=4)](https://github.com/pforret "pforret (16 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (14 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (12 commits)")[![riasvdv](https://avatars.githubusercontent.com/u/3626559?v=4)](https://github.com/riasvdv "riasvdv (10 commits)")[![patinthehat](https://avatars.githubusercontent.com/u/5508707?v=4)](https://github.com/patinthehat "patinthehat (10 commits)")[![crynobone](https://avatars.githubusercontent.com/u/172966?v=4)](https://github.com/crynobone "crynobone (8 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (8 commits)")[![irfanm96](https://avatars.githubusercontent.com/u/42065936?v=4)](https://github.com/irfanm96 "irfanm96 (5 commits)")[![thecaliskan](https://avatars.githubusercontent.com/u/13554944?v=4)](https://github.com/thecaliskan "thecaliskan (5 commits)")[![IGedeon](https://avatars.githubusercontent.com/u/694313?v=4)](https://github.com/IGedeon "IGedeon (4 commits)")[![abenerd](https://avatars.githubusercontent.com/u/7523903?v=4)](https://github.com/abenerd "abenerd (3 commits)")[![jessarcher](https://avatars.githubusercontent.com/u/4977161?v=4)](https://github.com/jessarcher "jessarcher (3 commits)")[![koossaayy](https://avatars.githubusercontent.com/u/6431084?v=4)](https://github.com/koossaayy "koossaayy (3 commits)")[![lloricode](https://avatars.githubusercontent.com/u/8251344?v=4)](https://github.com/lloricode "lloricode (3 commits)")[![maartenpaauw](https://avatars.githubusercontent.com/u/4550875?v=4)](https://github.com/maartenpaauw "maartenpaauw (3 commits)")

---

Tags

apiclientlaravelwmbhfibery

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/wmbh-laravel-fibery/health.svg)

```
[![Health](https://phpackages.com/badges/wmbh-laravel-fibery/health.svg)](https://phpackages.com/packages/wmbh-laravel-fibery)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[mozex/anthropic-laravel

Anthropic PHP for Laravel is a supercharged PHP API client that allows you to interact with the Anthropic API

71226.4k1](/packages/mozex-anthropic-laravel)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)[njoguamos/laravel-plausible

A laravel package for interacting with plausible analytics api.

208.8k](/packages/njoguamos-laravel-plausible)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1221.1k](/packages/codebar-ag-laravel-docuware)[codebar-ag/laravel-zammad

Zammad integration with Laravel

106.1k](/packages/codebar-ag-laravel-zammad)

PHPackages © 2026

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