PHPackages                             netflex/commerce - 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. netflex/commerce

ActiveLibrary

netflex/commerce
================

Netflex Commerce library

v6.4.0(6mo ago)0989↑50%2MITPHPPHP ^8.2

Since Jan 14Pushed 2mo agoCompare

[ Source](https://github.com/netflex-sdk/commerce)[ Packagist](https://packagist.org/packages/netflex/commerce)[ RSS](/packages/netflex-commerce/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (18)Versions (299)Used By (2)

Netflex Commerce
================

[](#netflex-commerce)

[![Stable version](https://camo.githubusercontent.com/4982b8ae024769e464f5c3cb493be08cca9b1d2e55ae6a9cd01a392be66eaeae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6574666c65782f636f6d6d657263653f6c6162656c3d737461626c65)](https://packagist.org/packages/netflex/commerce)[![Build status](https://github.com/netflex-sdk/framework/actions/workflows/split_monorepo.yaml/badge.svg)](https://github.com/netflex-sdk/framework/actions/workflows/split_monorepo.yaml)[![License: MIT](https://camo.githubusercontent.com/4ab654ac03c01efe43cce5fc4de153c5bef02688bd1f4d004ffd69ac63c31211/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e6574666c65782d73646b2f6c6f672e737667)](https://opensource.org/licenses/MIT)[![Contributors](https://camo.githubusercontent.com/e01836b76903338fa30a2133b13b6a0ae9710f22af63bd0f66128df370003623/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f6e6574666c65782d73646b2f73646b2e7376673f636f6c6f723d677265656e)](https://github.com/netflex-sdk/sdk/graphs/contributors)[![Downloads](https://camo.githubusercontent.com/236e06ac66f30909cb9bfe689fca7c773e4f876636063ab849f18b298a2f1b43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6e6574666c65782f636f6d6d65726365)](https://packagist.org/packages/netflex/commerce/stats)

\[READ ONLY\] Subtree split of the Netflex Commerce component (see [netflex/framework](https://github.com/netflex-sdk/framework))

The Netflex Commerce library is for working with the commerce endpoints in the Netflex API.

[![Downloads](https://camo.githubusercontent.com/236e06ac66f30909cb9bfe689fca7c773e4f876636063ab849f18b298a2f1b43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6e6574666c65782f636f6d6d65726365)](https://packagist.org/packages/netflex/commerce/stats)[![Stable version](https://camo.githubusercontent.com/4982b8ae024769e464f5c3cb493be08cca9b1d2e55ae6a9cd01a392be66eaeae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6574666c65782f636f6d6d657263653f6c6162656c3d737461626c65)](https://packagist.org/packages/netflex/commerce)[![License: MIT](https://camo.githubusercontent.com/f2e3e4b5f93b874501f310837c226b772f4987d17c6f2871adca9e78d9fb20a2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e6574666c65782d73646b2f73646b2e737667)](https://opensource.org/licenses/MIT)

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

[](#installation)

```
composer require netflex/commerce
```

Getting started TL;DR
---------------------

[](#getting-started-tldr)

```
// Creating new order and checking out
$order = Order::create()
  ->addToSession()
  ->addCart([
    'entry_id' => 10001,
    'entry_name' => 'Ticket',
    'variant_cost' => 100,
    'no_of_entries' => 1,
    'tax_percent' => 1.12
  ])
  ->checkout([
    'firstname' => 'Ola',
    'surname' => 'Nordmann'
  ])
  ->save([
    'status' => 'p',
    'currency' => 'NOK',
    'customer_mail' => 'ola@nordmann.no',
    'customer_phone' => '99123456'
  ])
  ->addData('paymentId', '123456789', 'Payment ID')
  ->addLog('Customer sent to payment');

// Adding payment and completing order
$order = Order::retrieveBySecret('a72b...12f4')
  ->addLog('Customer returned from payment')
  ->addPayment([
    'payment_method' => 'stripe',
    'amount' => 100,
    'status' => 'OK',
    'capture_status' => 'OK',
    'transaction_id' => '123456789',
    'card_type_name' => 'visa',
  ])
  ->register()
  ->lock()
  ->removeFromSession();
```

Getting started properly
------------------------

[](#getting-started-properly)

Always start with an Order object. Order is the main class of this library, meant to hold all other objects.

```
// Empty object. Does NOT create an order in the API.
$order = new Order();

// Creating and getting a new empty order in the API.
$order = Order::create();

// Retrieves an existing order from the API based on an order id. Throws an exception if not found.
$order = Order::retrieve(10001);

// Retrieves an existing order from the API based on a register id. Throws an exception if not found.
$order = Order::retrieveByRegisterId(10001);

// Retrieves an existing order from the API based on an order secret. Throws an exception if not found.
$order = Order::retrieveBySecret('a1234567896e8bf63bbd43e851811234');

// Retrieves an existing order from the API based on an order secret stored in $_SESSION.
// If session or order does not exist, it creates an empty object.
// It does NOT create a new empty order in the API.
// On the next save() or refresh(), it stores the order secret in session.
$order = Order::retrieveBySession();

// Retrieves an existing order from the API based on an order secret stored in $_SESSION.
// If session or order does not exist, it creates a new empty order in the API
// and stores the order secret in session.
$order = Order::retrieveBySessionOrCreate();

// Manually adding the order secret to session.
$order->addToSession();
```

Adding things to the order
--------------------------

[](#adding-things-to-the-order)

On all add-methods below, the data is immediately sent to the API. To update the order object with added items and calculated totals, you need to call the refresh() method.

```
$order->addCart([
  'entry_id' => 10001,
  'entry_name' => 'Ticket',
  'variant_cost' => 100,
  'no_of_entries' => 1,
  'tax_percent' => 1.12,
  'properties' => [
    'someCustomKey' => 'someCustomValue'
  ]
]);

$order->addLog('This is a log item');

$order->addLogInfo('Log some info');
$order->addLogWarning('Log a warning');
$order->addLogSuccess('Log a success');
$order->addLogDanger('Log danger');

$order->addData('key', 'value', 'Label');

$order->addDiscount([
  'scope' => 'item', // cart|item|shipping
  'scope_key' => '10001', // cart item id
  'label' => '20 % discount on your ticket',
  'discount' => 0.20,
  'type' => 'percent', // percent|fixed|amount
]);

$order->addPayment([
  'payment_method' => 'stripe',
  'amount' => 100,
  'status' => 'OK',
  'capture_status' => 'OK',
  'transaction_id' => '123456789',
  'card_type_name' => 'visa',
  'data' => [
    'someCustomKey' => 'someCustomValue'
  ]
]);

// Updating the order object with added items and calculated totals
$order->refresh();
```

It is also possible to pass in and Item object in most of the add methods.

```
$cartItem = new CartItem();

$cartItem->entry_id = 10001;
$cartItem->entry_name = 'Ticket';
$cartItem->variant_cost = 100;
$cartItem->no_of_entries = 1;
$cartItem->tax_percent = 1.12;

$order->addCart($cartItem);
```

Updating the order
------------------

[](#updating-the-order)

Updating the properties on the main order object. Option A:

```
$order->status = 'p';
$order->currency = 'NOK';
$order->customer_mail = 'ola@nordmann.no';
$order->customer_phone = '99123456';
$order->save();
```

Option B:

```
$order->save([
  'status' => 'p',
  'currency' => 'NOK',
  'customer_mail' => 'ola@nordmann.no',
  'customer_phone' => '99123456'
]);
```

Updating a cart item. Option A:

```
// Updating the number of entries on cart items with a specific entry_id
foreach ($order->cart->items as $item) {
  if ($item->entry_id == 10001) {
    $item->no_of_entries = 5;
    $item->save();
  }
}
```

Option B:

```
foreach ($order->cart->items as $item) {
  if ($item->entry_id == 10001) {
    $item->save(['no_of_entries' => 5]);
  }
}
```

Checking out and completing the order
-------------------------------------

[](#checking-out-and-completing-the-order)

```
$order->checkout([
  'firstname' => 'Ola',
  'surname' => 'Nordmann'
]);

$order->register();

$order->saveStatus('n');

$order->checkoutEnd();

// This does the same as saveStatus('n') and checkoutEnd();
// Saves the status to 'n' and add a checkout_end date.
$order->lock();

$order->removeFromSession();
```

Search query builder
--------------------

[](#search-query-builder)

This package use the [Netflex QueryBuilder library](https://github.com/netflex-sdk/query-builder), so you can easily search for and return a collection of orders.

```
$orders = Order::where('data.someCustomKey', 'someCustomValue')->get();
```

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

[](#contributing)

Thank you for considering contributing to the Netflex Commerce library! Please read the [contribution guide](CONTRIBUTING.md).

Code of Conduct
---------------

[](#code-of-conduct)

In order to ensure that the community is welcoming to all, please review and abide by the [Code of Conduct](CODE_OF_CONDUCT.md).

License
-------

[](#license)

The Netflex Commerce library is open-sourced software licensed under the [MIT license](LICENSE).

---

Copyright © 2020 **[Apility AS](https://apility.no)**

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance78

Regular maintenance activity

Popularity18

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity89

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 99.6% 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

298

Last Release

192d ago

Major Versions

v4.5.0 → v5.2.62025-01-20

v4.50.1 → v5.4.02025-02-07

v4.50.2 → v5.4.32025-06-25

v5.4.4 → v6.0.12025-08-17

v4.50.3 → v6.1.62025-09-04

PHP version history (2 changes)4.0.4PHP ^7.4|^8.0

v6.0.4PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/302a4d5539139f2957faf60d731a0fbb346a2a1419acf9ace282e91a3edd8099?d=identicon)[thomas-alrek](/maintainers/thomas-alrek)

![](https://www.gravatar.com/avatar/97d9dcfd4829656029114c949558873ff0687b8104194f6726b4d7137f9b77e8?d=identicon)[tormundgerhardsen](/maintainers/tormundgerhardsen)

---

Top Contributors

[![thomas-alrek](https://avatars.githubusercontent.com/u/14291825?v=4)](https://github.com/thomas-alrek "thomas-alrek (241 commits)")[![actions-user](https://avatars.githubusercontent.com/u/65916846?v=4)](https://github.com/actions-user "actions-user (1 commits)")

### Embed Badge

![Health badge](/badges/netflex-commerce/health.svg)

```
[![Health](https://phpackages.com/badges/netflex-commerce/health.svg)](https://phpackages.com/packages/netflex-commerce)
```

###  Alternatives

[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)
