PHPackages                             nexagon/flow-php - 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. nexagon/flow-php

ActiveLibrary

nexagon/flow-php
================

Nexagon Flow API library for php

1.2.6(5y ago)0261MITPHPPHP ^7.1

Since Sep 25Pushed 5y ago1 watchersCompare

[ Source](https://github.com/NexagonIVS/flow-php)[ Packagist](https://packagist.org/packages/nexagon/flow-php)[ Docs](https://nexagon.dk)[ RSS](/packages/nexagon-flow-php/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (9)Dependencies (2)Versions (10)Used By (0)

Flow PHP library
================

[](#flow-php-library)

The Flow PHP library provides convenient access to resources on the Nexagon Flow API for applications written in PHP.

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

[](#requirements)

PHP 7.2 and later

Composer
--------

[](#composer)

You can install flow-php with composer. Run the following command:

```
composer require nexagon/flow-php
```

To use the library, use the autoloader from composer:

```
require_once('vendor/autoload.php');
```

Manual installation
-------------------

[](#manual-installation)

If you do not wish to use composer, you can download the code from this repo. Then, to use the library, simply include the `init.php` file.

```
require_once('/path/to/flow-php/init.php');
```

Dependencies
------------

[](#dependencies)

The sdk uses the following dependencies.

- `guzzlehttp/guzzle`
- `json`

If you are using composer, everything should work out of the box. Otherwise, make sure these extensions are available.

Getting started
---------------

[](#getting-started)

Simple usage of the library:

```
$flow = new Flow\FlowClient("api-key-goes-here");
[$customer,] = $flow->customers->create([
    "name" => "Test customer",
    "email" => "some@email.test",
    "reference_identifier" => "some reference",
    "locations" => [
        "name" => "Headquarters",
        "phone" => "004588888888",
        "address_line_1" => "Test street 2",
        "postal_code" => "8000",
        "city" => "Aarhus",
        "country" => "DK",
    ],
]);

[$order,] = $flow->orders->create([
    "customer_group" => $customer->id,
]);
echo $order;
```

### Changing the API-endpoint

[](#changing-the-api-endpoint)

You might need to change the API-endpoint, if you are testing, or working on a staging environment.

```
$flow = new Flow\FlowClient("api-key-goes-here", "http://localhost:8000/");
// or
$flow->setApiEndpoint("http://sometest-endpoint.test");
```

Remember to append a slash `/` at the end. Otherwise, requests may fail.

### Uploading files and adding multiple file-versions

[](#uploading-files-and-adding-multiple-file-versions)

Whenever you need to add a file to flow, it must first be created and uploaded before any resources can consume it. Use the following as a reference for uploading files to flow

```
$flow = new Flow\FlowClient("api-key-goes-here");
$stream = fopen("path/to/file.png", "r");
$mimetype = mime_content_type("path/to/file.png");
[$file,] = $flow->files->createAndUpload($stream, "file.png", $mimetype);

// Consume the file on order lines or other resources
$order_line_data = [
    "files" => [$file->id],
    ... // Any other required order line data - see documentation
];
[$order,] = $flow->orders->create([
    "order_lines" => [$order_line_data]
]);
```

If one needs to update a file, one must add a new version:

```
$flow = new Flow\FlowClient("api-key-goes-here");
$stream = ...;
$name = ...;
$mimetype = ...;
[$file, ] = $flow->files->addFileVersion($stream, $name, $mimetype);

// You have access to all version
foreach ($file->versions as &$version) {
    if ($version->latest) {
        print_r("Im the latest version ($version->last_modified)! Download me here: $version->url");
    }
}
```

Documentation
-------------

[](#documentation)

See the [Nexagon Flow documentation](https://docs.nexagon.dk).

Accessing request
-----------------

[](#accessing-request)

You can access the `Gruzzle\Request` directly:

```
$flow = new Flow\FlowClient("api-key-goes-here");
[$order, $request] = $flow->orders->retrieve(1);

echo $request->getStatusCode();
```

Note that all requests with a statuscode &gt;= 300 will fail and throw a `FlowException`.

License
-------

[](#license)

MIT License

Copyright (c) 2020 Nexagon IVS

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

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

Total

9

Last Release

2000d ago

PHP version history (2 changes)1.0.0PHP ^7.2

1.2.1PHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/a71b3a6c547fbc56258835a213800144190bdf0248b2346b1d502cdece039d82?d=identicon)[magnus@nexagon.dk](/maintainers/magnus@nexagon.dk)

---

Top Contributors

[![magnusmeng](https://avatars.githubusercontent.com/u/5425866?v=4)](https://github.com/magnusmeng "magnusmeng (20 commits)")[![FrontIT-SJ](https://avatars.githubusercontent.com/u/6330589?v=4)](https://github.com/FrontIT-SJ "FrontIT-SJ (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nexagon-flow-php/health.svg)

```
[![Health](https://phpackages.com/badges/nexagon-flow-php/health.svg)](https://phpackages.com/packages/nexagon-flow-php)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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