PHPackages                             ubnt/ucrm-plugin-sdk - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ubnt/ucrm-plugin-sdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ubnt/ucrm-plugin-sdk
====================

UCRM plugin SDK

0.13.0(10mo ago)102.3k↓33.3%14MITPHPPHP &gt;=8.1,&lt;8.4CI passing

Since Nov 16Pushed 10mo ago5 watchersCompare

[ Source](https://github.com/Ubiquiti-App/UCRM-Plugin-SDK)[ Packagist](https://packagist.org/packages/ubnt/ucrm-plugin-sdk)[ Docs](https://github.com/Ubiquiti-App/UCRM-Plugin-SDK)[ RSS](/packages/ubnt-ucrm-plugin-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (19)Used By (0)

UCRM Plugin SDK
===============

[](#ucrm-plugin-sdk)

[![Coverage](https://camo.githubusercontent.com/5069b2e93d928ea9ce894aca48e70b36236500a5b6a50fa461e28fa1ce43ff09/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6769746875622f55626971756974692d4170702f5543524d2d506c7567696e2d53444b2e737667)](https://coveralls.io/github/Ubiquiti-App/UCRM-Plugin-SDK)[![Latest Release](https://camo.githubusercontent.com/e075ca221180321ea80e21236b51aa28bf2977dc07d3affc07a882c391e4a698/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f55626971756974692d4170702f5543524d2d506c7567696e2d53444b2e737667)](https://packagist.org/packages/ubnt/ucrm-plugin-sdk)[![License](https://camo.githubusercontent.com/def9244d7afe933540bef2d34357385a91f911be7d8764c9dbaa34f05fffe5e3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f55626971756974692d4170702f5543524d2d506c7567696e2d53444b2e737667)](https://packagist.org/packages/ubnt/ucrm-plugin-sdk)

This repository contains the open source PHP SDK for [UCRM plugins](https://github.com/Ubiquiti-App/UCRM-plugins).

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

[](#installation)

The UCRM Plugin SDK can be installed with [Composer](https://getcomposer.org/). Run this command:

```
composer require ubnt/ucrm-plugin-sdk

```

Available classes
-----------------

[](#available-classes)

Class nameDescription[Ubnt\\UcrmPluginSdk\\Service\\UcrmApi](src/UcrmPluginSdk/Service/UcrmApi.php)A service that handles calling UCRM API.[Ubnt\\UcrmPluginSdk\\Service\\UnmsApi](src/UcrmPluginSdk/Service/UnmsApi.php)A service that handles calling UNMS API.[Ubnt\\UcrmPluginSdk\\Service\\UcrmSecurity](src/UcrmPluginSdk/Service/UcrmSecurity.php)A service that handles getting data of user currently logged into UCRM.[Ubnt\\UcrmPluginSdk\\Service\\PluginLogManager](src/UcrmPluginSdk/Service/PluginLogManager.php)A service that handles managing the plugin's log file.[Ubnt\\UcrmPluginSdk\\Service\\UcrmOptionsManager](src/UcrmPluginSdk/Service/UcrmOptionsManager.php)A service that handles loading automatically generated options available to the plugin.[Ubnt\\UcrmPluginSdk\\Service\\PluginConfigManager](src/UcrmPluginSdk/Service/PluginConfigManager.php)A service that handles loading configuration of the plugin as defined in the plugin's manifest file.Usage
-----

[](#usage)

Simple example using available SDK classes:

```
require_once __DIR__ . '/vendor/autoload.php';

// Get UCRM log manager.
$log = \Ubnt\UcrmPluginSdk\Service\PluginLogManager::create();

// Check if there is a user logged into UCRM and has permission to view invoices.
// https://github.com/Ubiquiti-App/UCRM-plugins/blob/master/docs/security.md
$security = \Ubnt\UcrmPluginSdk\Service\UcrmSecurity::create();
$user = $security->getUser();
if (
    ! $user
    || ! $user->hasViewPermission(\Ubnt\UcrmPluginSdk\Security\PermissionNames::BILLING_INVOICES)
) {
    if (! headers_sent()) {
        header("HTTP/1.1 403 Forbidden");
    }

    $log->appendLog('Someone tried to access page only for admins with permission to view invoices.');

    die('You\'re not allowed to access this page.');
}

$log->appendLog('Starting invoice export.');

// Get export format from plugin's configuration.
// https://github.com/Ubiquiti-App/UCRM-plugins/blob/master/docs/manifest.md#configuration
$configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create();
$config = $configManager->loadConfig();
// the "exportFormat" key must be defined in plugin's manifest file, see the link above
$exportFormat = $config['exportFormat'];

// Get UCRM API manager.
$api = \Ubnt\UcrmPluginSdk\Service\UcrmApi::create();

// Load invoices from UCRM API ordered by created date in descending direction.
// https://ucrm.docs.apiary.io/#reference/invoices/invoicesclientidcreateddatefromcreateddateto/get
$invoices = $api->get(
    'invoices',
    [
        'order' => 'createdDate',
        'direction' => 'DESC',
    ]
);

foreach ($invoices as $invoice) {
    // some export implementation, using the $exportFormat
}

// Get plugin's public URL from automatically generated UCRM options.
// https://github.com/Ubiquiti-App/UCRM-plugins/blob/master/docs/file-structure.md#ucrmjson
$optionsManager = \Ubnt\UcrmPluginSdk\Service\UcrmOptionsManager::create();
$pluginPublicUrl = $optionsManager->loadOptions()->pluginPublicUrl;

$log->appendLog(sprintf('Finished invoice export. Take a look at %s.', $pluginPublicUrl));
```

Pack script
-----------

[](#pack-script)

To pack your plugin for use in UCRM, you can use the provided pack script. Run this command from the root directory:

```
./vendor/bin/pack-plugin

```

The script will create ZIP archive of the plugin, which can be uploaded to UCRM. If you are using the directory structure of official [UCRM plugins repository](https://github.com/Ubiquiti-App/UCRM-plugins) the archive will be created one level up, next to your `README.md` file and `src/` directory. Otherwise it will be created in your root directory.

> If the plugin's root directory is not detected correctly, you can give it to the script as an argument. For example:
> `./vendor/bin/pack-plugin /home/username/my-new-plugin`

Tests
-----

[](#tests)

Unit tests can be executed by running this command from the root directory:

```
./vendor/bin/phpunit

```

Static analysis can be executed by running this command from the root directory:

```
./vendor/bin/phpstan analyse src tests --level max

```

Coding standard check can be executed by running this command from the root directory:

```
./vendor/bin/ecs check src tests

```

Disclaimer
----------

[](#disclaimer)

The software is provided "as is", without any warranty of any kind. Read more in the [licence](https://github.com/Ubiquiti-App/UCRM-Plugin-SDK/blob/master/LICENSE.md).

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance54

Moderate activity, may be stable

Popularity29

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

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

Recently: every ~213 days

Total

18

Last Release

313d ago

PHP version history (5 changes)0.1.0PHP &gt;=7.1.0

0.6.0PHP &gt;=7.3.0

0.8.2PHP &gt;=7.4.0

0.9.0PHP &gt;=8.1

0.13.0PHP &gt;=8.1,&lt;8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/638da8f6fd4937b9c0dfaf0730e090e84e23fb024f2e9b882d0b2a2c2964d143?d=identicon)[keksa](/maintainers/keksa)

![](https://www.gravatar.com/avatar/8cfbd4ee356d06daf56c61b3d883b9431a6e0a2ca98b90b5fdfa8a6f02726ebe?d=identicon)[UBNT-Petr](/maintainers/UBNT-Petr)

---

Top Contributors

[![keksa](https://avatars.githubusercontent.com/u/7985651?v=4)](https://github.com/keksa "keksa (52 commits)")[![janprochazkacz](https://avatars.githubusercontent.com/u/6412097?v=4)](https://github.com/janprochazkacz "janprochazkacz (8 commits)")[![ajoah](https://avatars.githubusercontent.com/u/10757301?v=4)](https://github.com/ajoah "ajoah (5 commits)")[![Piskvor](https://avatars.githubusercontent.com/u/917239?v=4)](https://github.com/Piskvor "Piskvor (1 commits)")

---

Tags

crmplugin-extensionsdkucrmsdkucrm

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ubnt-ucrm-plugin-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/ubnt-ucrm-plugin-sdk/health.svg)](https://phpackages.com/packages/ubnt-ucrm-plugin-sdk)
```

###  Alternatives

[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[infusionsoft/php-sdk

PHP SDK for the Infusionsoft

1292.1M7](/packages/infusionsoft-php-sdk)[corley/influxdb-sdk

Send your app metrics to InfluxDB

84296.5k2](/packages/corley-influxdb-sdk)[eliashaeussler/typo3-solver

Extension for TYPO3 CMS to extend TYPO3's exception handling with AI generated solutions

292.1k](/packages/eliashaeussler-typo3-solver)

PHPackages © 2026

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