PHPackages                             cfxmarkets/php-public-models - 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. [Framework](/categories/framework)
4. /
5. cfxmarkets/php-public-models

ActiveLibrary[Framework](/categories/framework)

cfxmarkets/php-public-models
============================

This package provides all of CFX's public data objects.

v1.25.0(6y ago)01.4k[4 issues](https://github.com/cfxmarkets/php-public-models/issues)2MITPHPPHP &gt;=5.4.0

Since Nov 12Pushed 6y ago4 watchersCompare

[ Source](https://github.com/cfxmarkets/php-public-models)[ Packagist](https://packagist.org/packages/cfxmarkets/php-public-models)[ RSS](/packages/cfxmarkets-php-public-models/feed)WikiDiscussions v1.x Synced 2d ago

READMEChangelog (10)Dependencies (4)Versions (84)Used By (2)

PHP Public Models
=================

[](#php-public-models)

This library represents the current set of CFX's public PHP data models. This README will focus on the (very little) general business information surrounding the classes this library provides. For an in-depth discussion of each Resource class's business logic, see the [API Docs](https://apis.cfxtrading.com/cfx-brokerage-api.v2.json). (You can view that document more easily by pasting its contents into the editor at .) For an in-depth discussion of CFX's data model *implementation*, see [php-jsonapi-objects](https://github.com/cfxmarkets/php-public-models) and [php-persistence](https://github.com/cfxmarkets/php-persistence).

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

[](#installation)

This library can be installed using the standard composer process:

```
composer require cfxmarkets/php-public-models
```

Overview
--------

[](#overview)

Currently, there are two primary data domains that CFX operates in: The Brokerage Domain and the Exchange Domain.

The Brokerage Domain encapsulates objects and operations related to the CFX brokerage house. This includes Users, LegalEntities, OrderIntents, Orders, Addresses, BankAccounts, Assets, AssetIntents, DealRooms, TenderRooms, Tenders, and others. In short, any data that concerns a brokerage will be found in the Brokerage Domain.

The Exchange Domain encapsulates objects and operations related to the CFX exchange. This includes Brokerages, Orders, Assets, and Transactions. (Most of these are currently unimplemented at the time of this writing.)

Usage
-----

[](#usage)

Most of the important information in this library exists at the class level. That is, what you'll really want to learn about is 1) what classes exist; and 2) how you can use them. You can get this information most easily by simply browsing the classes themselves. However, if you haven't already, you may want to take a minute and familiarize yourself with the style in which this library was meant to be used, detailed in the following paragraphs and examples.

---

In general, the classes in this library rely on getters and setters to manipulate their data. They also include a few common update and persistence operations, namely `updateFromData`, `updateFromResource`, `save`, `initialize`, and `refresh`. You can use these methods (and a few others) on all of CFX's public model classes because these are part of the underlying `ResourceInterface` on which our resource objects are based.

Thus, following is a common example of how you might end up using these objects. Assume `$cfx` is the CFX Brokerage Client from the [`php-brokerage-sdk`](https://github.com/cfxmarkets/php-brokerage-sdk) library.

```
$user = $cfx->users->get("id=abc123");

$name = $user->getName();
$street1 = $user->getAddress()->getStreet1();
$street2 = $user->getAddress()->getStreet2();
$city = $user->getAddress()->getCity();
$state = $user->getAddress()->getState();
$country = $user->getAddress()->getCountry();
$zip = $user->getAddress()->getZip();

$orderIntent = $cfx->orderIntents->create()
    ->setType('sell')
    ->setPriceHigh(2.50)
    ->setPriceLow(2.10)
    ->setAsset($cfx->assets->get("id=INVT001"))
    ->setAssetOwner($user->getPersonEntity())
    ->setBankAccount($user->getBankAccounts()[0])
;

// (This is future functionality not implemented at the time of this writing)
if ($user->isAtLeast('financial-advisor')) {
    $orderIntent->setReferralKey($user->getId());
}

$orderIntent->save();

....
```

Notice here that the majority of these calls are simple getters and setters. The one call that is not (`User::isAtLeast`) is not yet implemented, but is a good example of what sorts of functionality might be introduced by non-setter/getter methods.

Beyond that, there's not too much more to point out. From here, you should study up on the [API Docs](https://apis.cfxtrading.com/cfx-brokerage-api.v2.json), as mentioned, and start writing code!

Note About API Documentation
----------------------------

[](#note-about-api-documentation)

We're hoping to launch a site (developers.cfxtrading.com) soon that will allow us to provide more comprehensive API documentation and other resources for developers. While this site is not live yet, you can still generate good API documentation for this library by cloning the library, installing [Sami](https://github.com/FriendsOfPHP/Sami), and running `sami.phar update sami.config.php`.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

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

Recently: every ~22 days

Total

84

Last Release

2388d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b76588c1d06ed54f5f5fe06e466d044b0527eb6e1b68a8e3dccd13e447fa43eb?d=identicon)[kael-shipman](/maintainers/kael-shipman)

---

Top Contributors

[![kael-shipman](https://avatars.githubusercontent.com/u/3475586?v=4)](https://github.com/kael-shipman "kael-shipman (17 commits)")[![QusaiFarraj](https://avatars.githubusercontent.com/u/20199563?v=4)](https://github.com/QusaiFarraj "QusaiFarraj (1 commits)")

---

Tags

apiframeworkexchangedata objectscfxbrokerage

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cfxmarkets-php-public-models/health.svg)

```
[![Health](https://phpackages.com/badges/cfxmarkets-php-public-models/health.svg)](https://phpackages.com/packages/cfxmarkets-php-public-models)
```

###  Alternatives

[ccxt/ccxt

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

41.5k328.9k1](/packages/ccxt-ccxt)[lanin/laravel-api-debugger

Easily debug your JSON API.

2311.8M](/packages/lanin-laravel-api-debugger)[gotzmann/comet

Modern PHP framework for building blazing fast REST APIs and microservices

68816.2k1](/packages/gotzmann-comet)[psx/psx

PHP REST API Framework

17112.6k3](/packages/psx-psx)[kornrunner/ccxt

A PHP cryptocurrency trading library with support for more than 90 bitcoin/altcoin exchanges

371.6k](/packages/kornrunner-ccxt)

PHPackages © 2026

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