PHPackages                             rebelpl/bc-api2-common - 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. rebelpl/bc-api2-common

ActiveLibrary[API Development](/categories/api)

rebelpl/bc-api2-common
======================

Business Central API common entities (Microsoft.NAV)

02PHP

Since Oct 1Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/rebelpl/bc-api2-common)[ Packagist](https://packagist.org/packages/rebelpl/bc-api2-common)[ RSS](/packages/rebelpl-bc-api2-common/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

Business Central API2 for PHP - Common Entities
===============================================

[](#business-central-api2-for-php---common-entities)

This library includes PHP models for all `Microsoft.NAV` entities from [Business Central API (v2.0)](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/), generated using the `Rebel\BCApi2\Entity\Generator` from [Business Central API2 for PHP](https://github.com/rebelpl/bc-api2-client).

Install
-------

[](#install)

```
composer require rebelpl/bc-api2-common
```

For PHP7.2 compatible version use:

```
composer require rebelpl/bc-api2-common:dev-php7.2
```

Usage
-----

[](#usage)

```
use Rebel\BCApi2\Entity\Item;
use Rebel\BCApi2\Entity\SalesOrder;
use Rebel\BCApi2\Request\Expression;

$client = new Rebel\BCApi2\Client(
    accessToken: '',
    environment: '',
    companyId: '',
);

$repository = new SalesOrder\Repository($client);
$repository->setExpandedByDefault([
    SalesOrder\Properties::salesOrderLines->name,
    SalesOrder\Properties::customer->name,
 ])

// Get a sales order by ID
$salesOrder = $repository->get('abc-123');

// Update properties of the sales order
$salesOrder->externalDocumentNumber = 'TEST';
$salesOrder->salesOrderLines[0]->quantity = 10;
$salesOrder->salesOrderLines[] = new Rebel\BCApi2\Entity\SalesOrderLine\Record([
    'itemId' => '12345',
    'quantity' => 5
]);

// Save all changes in one operation
$repository->save($salesOrder);

// find top 10 sales orders with filters
$orderBy = [ SalesOrder\Properties::orderDate->name => 'DESC' ];
$salesOrders = $repository->findBy([
    SalesOrder\Properties::customerNumber->name => '30000',
    Expression::greaterOrEqualThan(SalesOrder\Properties::orderDate->name, new \DateTime('today')),
    SalesOrder\Properties::shipToCountry->name => [ 'PL', 'DE' ],
], $orderBy, 10);

foreach ($salesOrders as $salesOrder) {
    echo " - {$salesOrder->number}:\t{$salesOrder->totalAmountIncludingTax} {$salesOrder->currencyCode}\n";
}

// upload picture for an item
$repository = new Item\Repository($client);

/** @var Item\Record $item */
$item = $repository->findOneBy([ 'number' => '100000' ]);

$file = file_get_contents('tests/files/picture.png');
$item->picture->pictureContent->uploadWith($client, $file, $item->picture->getETag());
```

Tests
-----

[](#tests)

```
./vendor/bin/phpunit
```

###  Health Score

16

—

LowBetter than 4% of packages

Maintenance41

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/411846?v=4)[Artur Jedliński](/maintainers/nataniel)[@nataniel](https://github.com/nataniel)

---

Top Contributors

[![nataniel](https://avatars.githubusercontent.com/u/411846?v=4)](https://github.com/nataniel "nataniel (12 commits)")

### Embed Badge

![Health badge](/badges/rebelpl-bc-api2-common/health.svg)

```
[![Health](https://phpackages.com/badges/rebelpl-bc-api2-common/health.svg)](https://phpackages.com/packages/rebelpl-bc-api2-common)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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