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 7mo 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 1mo ago

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

17

—

LowBetter than 6% of packages

Maintenance44

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

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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