PHPackages                             uspacy/uspacy-php-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. [API Development](/categories/api)
4. /
5. uspacy/uspacy-php-sdk

ActiveLibrary[API Development](/categories/api)

uspacy/uspacy-php-sdk
=====================

PHP SDK for Uspacy – a single workspace for managing key processes of your organization with a focus on results.

1.0.1(1mo ago)01.4k3MITPHPPHP ^8.2CI passing

Since Aug 17Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Uspacy/uspacy-php-sdk)[ Packagist](https://packagist.org/packages/uspacy/uspacy-php-sdk)[ RSS](/packages/uspacy-uspacy-php-sdk/feed)WikiDiscussions main Synced 4w ago

READMEChangelog (10)Dependencies (14)Versions (33)Used By (0)

Uspacy PHP SDK
==============

[](#uspacy-php-sdk)

PHP SDK for [Uspacy](https://uspacy.com) – a single workspace for managing key processes of your organization with a focus on results. Communication, collaboration and CRM. All-in-one.

Built on [Saloon](https://docs.saloon.dev/) and designed to mirror the official [JS](https://github.com/Uspacy/uspacy-js-sdk) and [Go](https://github.com/Uspacy/uspacy-go-sdk) SDKs. See the [Uspacy API reference](https://uspacy.readme.io/reference/introduction) for endpoint details.

Requirements
------------

[](#requirements)

- PHP `^8.2`
- Laravel `^11 || ^12 || ^13` (the SDK ships as a Laravel package)

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

[](#installation)

```
composer require uspacy/uspacy-php-sdk
```

The service provider is auto-discovered. Publish the config if you want to tune retries:

```
php artisan vendor:publish --provider="Uspacy\SDK\UspacySDKServiceProvider"
```

Quick start
-----------

[](#quick-start)

```
use Uspacy\SDK\Http\Client\UspacySDK;

// Base URL is your portal host, e.g. https://.uspacy.ua
$sdk = new UspacySDK('https://acme.uspacy.ua', $accessToken);

// Most methods return a Saloon\Http\Response — use ->json(), ->status()
$deals = $sdk->crm()->getDeals(['page' => 1, 'list' => 20])->json();

// Some services return typed DTOs (see "Typed responses" below)
$user = $sdk->users()->getUserById(7); // UserDTO
```

Typed responses (DTOs)
----------------------

[](#typed-responses-dtos)

Most methods return a raw `Saloon\Http\Response`. Selected services return **typed DTOs** (`Uspacy\SDK\DTOs\...`) for a nicer developer experience — currently:

- **Auth** — `applicationSignIn()` / `refreshToken()` return a `Tokens` DTO.
- **Users** — see the [Users service guide](docs/users.md).
- **CRM entities** — see the [CRM service guide](docs/crm.md).
- **Tasks** — see the [Tasks service guide](docs/tasks.md).
- **Messenger** (partial) — see the [Messenger service guide](docs/messenger.md).

Every output DTO keeps the **full raw payload**, so portal-specific **custom fields are never dropped**. Read them with `get()` / `has()`:

```
$user = $sdk->users()->getUserById(7);
$user->firstName;              // typed field
$user->get('customfield_1');   // custom field (or null)
$user->has('customfield_2');   // true / false
$user->raw;                    // the complete, untouched API payload
```

### Service guides

[](#service-guides)

- [Users](docs/users.md) — full DTO reference and examples.
- [CRM entities](docs/crm.md) — entity + field DTOs, custom fields.
- [Tasks](docs/tasks.md) — task + field DTOs, checklists, custom fields.
- [Messenger](docs/messenger.md) — quick answers, chats, settings (partial).

Architecture
------------

[](#architecture)

The SDK exposes **service facades** on the connector, mirroring the JS SDK's `httpClient.client.get/post/...` design:

- `UspacySDK` — the Saloon connector (auth, retries, base URL).
- `HttpClient` — a thin verb-oriented wrapper (`get/post/patch/put/delete/postForm`).
- Generic request classes (`GetRequest`, `PostRequest`, …) build the actual HTTP calls.
- One `*Service` per domain, each owning its API namespace.

Every service is reachable through an accessor on the connector:

AccessorServiceModule`$sdk->crm()``CrmService``crm/v1``$sdk->smartObjects()``SmartObjectsService``crm/v1``$sdk->tasks()``TasksService``tasks/v1``$sdk->activities()``ActivitiesService``activities/v1``$sdk->users()``UsersService``company/v1``$sdk->departments()``DepartmentsService``company/v1``$sdk->groups()``GroupsService``groups/v1``$sdk->comments()``CommentsService``comments/v1``$sdk->newsFeed()``NewsFeedService``newsfeed/v1``$sdk->emails()``EmailsService``email/v1``$sdk->files()``FilesService``files/v1``$sdk->messenger()``MessengerService``messenger/v1``$sdk->settings()``SettingsService``settings/v1``$sdk->auth()``AuthService``auth/v1``$sdk->profile()``ProfileService``company/v1/users/me``$sdk->roles()``RolesService``company/v1` · `crm/v1``$sdk->webhooks()``WebhooksService``company/v1/webhooks``$sdk->oauthClients()``OAuthClientsService``company/v1/oauth_clients``$sdk->invites()``InvitesService``company/v1``$sdk->notifications()``NotificationsService``notifications/v1``$sdk->tasksTimer()``TasksTimerService``tasks/v1/timer``$sdk->history()``HistoryService``history/v1``$sdk->marketing()``MarketingService``marketing/v1``$sdk->analytics()``AnalyticsService``analytics-backend/v1``$sdk->automations()``AutomationsService``automations-backend/v1``$sdk->migrations()``MigrationsService`import status/control### CRM-family services (JS-parity)

[](#crm-family-services-js-parity)

Dedicated, entity-scoped CRM services mirroring the JS SDK:

AccessorServiceScope`$sdk->crmDeals()` / `$sdk->crmLeads()` / `$sdk->crmContacts()` / `$sdk->crmCompanies()``CrmEntityService``/crm/v1/entities/{type}``$sdk->crmDealsFunnels()` / `$sdk->crmLeadsFunnels()``CrmFunnelsService`funnels, stages, reasons`$sdk->crmDealsStages()` / `$sdk->crmLeadsStages()``CrmStagesService`stages, reasons`$sdk->crmProducts()``CrmProductsService``/crm/v1/static/products``$sdk->crmProductsCategories()``CrmProductsCategoryService``/crm/v1/static/product-categories``$sdk->crmProductsUnits()``CrmProductsUnitService``/crm/v1/static/measurement-units``$sdk->crmProductsTaxes()``CrmProductsTaxesService``/crm/v1/static/taxes``$sdk->crmProductsPriceTypes()``CrmProductsPriceTypesService``/crm/v1/static/product-price-types``$sdk->crmProductsForEntity()``CrmProductsForEntityService``/crm/v1/static/list-products``$sdk->crmRequisites()``CrmRequisitesService``/crm/v1/requisites``$sdk->crmDocumentTemplates()``CrmDocumentTemplatesService``/crm/v1/documents/templates`Examples
--------

[](#examples)

### CRM

[](#crm)

```
// Entities
$sdk->crm()->getEntityTypes();
$sdk->crm()->getEntities('deals', ['page' => 1, 'list' => 50]);
$sdk->crm()->getContacts(['q' => 'ada@example.com']);

$sdk->crm()->createDeal(['title' => 'New deal', 'amount' => 1000]);
$sdk->crm()->patchEntity('deals', 42, ['amount' => 1500]);
$sdk->crm()->massEditEntities('deals', ['all' => true, 'settings' => [/* ... */]]);

// Fields
$sdk->crm()->getFields('deals');
$sdk->crm()->createField('deals', ['name' => 'Priority', 'type' => 'list']);
$sdk->crm()->deleteField('deals', 'priority');

// Funnels & kanban stages
$sdk->crm()->getFunnels('deals');
$sdk->crm()->getFunnelStagesByFunnelId('deals', 3);
$sdk->crm()->moveFunnelStage('deals', 42, 'stage-id', ['reason' => 'won']);

// Entity-scoped CRM services (JS-parity)
$sdk->crmDeals()->getEntities(['page' => 1]);
$sdk->crmDeals()->createEntity(['title' => 'New deal']);
$sdk->crmDeals()->massDeletion(entityIds: [1, 2, 3]);
$sdk->crmDeals()->moveFromStageToStage(42, 9, reasonId: 3);

$sdk->crmDealsFunnels()->getFunnels();
$sdk->crmDealsStages()->getStages();

// Products catalog
$sdk->crmProducts()->getProducts(['page' => 1]);
$sdk->crmProductsTaxes()->createProductTax(['name' => 'VAT', 'rate' => 20]);
$sdk->crmProductsForEntity()->createProductsForEntity([['product_id' => 1, 'quantity' => 2]]);

// Requisites & document templates
$sdk->crmRequisites()->getCardRequisites(['entity_id' => 5]);
$sdk->crmDocumentTemplates()->getDocumentTemplates();

// Products, calls, CRM tasks
$sdk->crm()->createProduct(['name' => 'Widget', 'price' => 9.99]);
$sdk->crm()->createCall(['direction' => 'inbound', 'phone' => '+380...']);
$sdk->crm()->createTask(['title' => 'Follow up']);
```

### Tasks

[](#tasks)

```
$sdk->tasks()->getTasks(['page' => 1]);
$sdk->tasks()->getTask(15, ['crm_entity_list' => true]);
$sdk->tasks()->createTask(['title' => 'Ship SDK', 'responsibleId' => 7]);
$sdk->tasks()->updateTaskStatus(15, 'in_work');
$sdk->tasks()->delegateTask(15, 42);
$sdk->tasks()->markTaskReady(15);
$sdk->tasks()->massDeletionTasks(taskIds: ['15', '16']);

// Templates, checklists, transfers, trash
$sdk->tasks()->getRecurringTemplates();
$sdk->tasks()->createChecklist(15, ['name' => 'Launch']);
$sdk->tasks()->createChecklistItem(9, ['text' => 'Write tests']);
$sdk->tasks()->transferTasksToUser(['from_user_id' => 1, 'to_user_id' => 2]);
$sdk->tasks()->getTrashTasks();
```

### Users &amp; departments

[](#users--departments)

```
$sdk->users()->getAllUsers();
$sdk->users()->getUsers(['page' => 2, 'list' => 20]);
$sdk->users()->updateUser(7, ['position' => 'CTO']);
$sdk->users()->deactivateUser(7);
$sdk->users()->updateRoles(7, ['admin']);
$sdk->users()->get2FaStatus(7);
$sdk->users()->search(['q' => 'ada@example.com']);
$sdk->users()->getUsersOnlineStatuses();
$sdk->users()->uploadAvatar(file_get_contents('/path/avatar.png'), userId: 7, filename: 'avatar.png');

$sdk->departments()->getDepartments();
$sdk->departments()->addUsers(4, [7, 8, 9]);
```

### Files (multipart upload)

[](#files-multipart-upload)

```
$sdk->files()->uploadFiles(
    [['name' => 'contract.pdf', 'data' => file_get_contents('/path/contract.pdf')]],
    entityType: 'deals',
    entityId: '42',
);

$sdk->files()->getFileById(101);
$sdk->files()->deleteFilesByEntity('deals', 42);
```

### Messenger

[](#messenger)

```
$sdk->messenger()->getExternalLines();
$sdk->messenger()->createMessage(['chatId' => 1, 'text' => 'Hello']);
$sdk->messenger()->goToMessage('message-id');

// Chats, messages, widgets, quick replies, relations, settings
$sdk->messenger()->getChats(['status' => 'open']);
$sdk->messenger()->getMessages(['chatId' => 1]);
$sdk->messenger()->readAllMessages(1);
$sdk->messenger()->createQuickAnswer(['title' => 'Greeting', 'text' => 'Hi!']);
$sdk->messenger()->getChatRelations(1);
$sdk->messenger()->updateSettings(['sound' => false]);
```

### Auth

[](#auth)

```
$tokens = $sdk->auth()->applicationSignIn($clientId, $clientSecret); // Tokens DTO
$sdk->auth()->refreshToken();
```

### Platform services

[](#platform-services)

```
// Profile (current user)
$sdk->profile()->getProfile();
$sdk->profile()->enable2Fa();
$sdk->profile()->getRequisites();

// Roles & permissions
$sdk->roles()->getRoles();
$sdk->roles()->getPermissionsFunnels('admin');

// Webhooks (outgoing, or incoming via the $isIncoming flag)
$sdk->webhooks()->getWebhooks(page: 1);
$sdk->webhooks()->createWebhook(['url' => 'https://...'], isIncoming: true);

// OAuth clients, invites, notifications
$sdk->oauthClients()->getOAuthClients();
$sdk->invites()->createInvitesBatch(['ada@example.com']);
$sdk->notifications()->getNotifications();

// Task timer + change history
$sdk->tasksTimer()->startTimer($taskId);
$sdk->history()->getChangesHistory('crm', 'deals', 42, ['page' => 1]);
```

### Growth / back-office

[](#growth--back-office)

```
// Marketing: email templates, newsletters, domains, senders
$sdk->marketing()->getEmailTemplates(['page' => 1]);
$sdk->marketing()->createEmailNewsletter(['subject' => 'Launch']);
$sdk->marketing()->sendEmailNewsletter(5);
$sdk->marketing()->getSenders();

// Analytics: reports, dashboards, funnel conversion
$sdk->analytics()->getAnalyticsReportList();
$sdk->analytics()->getFunnelConversion(['funnel_id' => 3]);

// Automations: workers + workflows (processes)
$sdk->automations()->getWorkflows();
$sdk->automations()->createWorkflow(['name' => 'Onboarding']);

// Migrations: import status & control
$sdk->migrations()->getAllSystemsStatus();
$sdk->migrations()->stopImport('trello');
```

Error handling
--------------

[](#error-handling)

The connector uses Saloon's `AlwaysThrowOnErrors`, so non-2xx responses throw a `Saloon\Exceptions\Request\RequestException`. Message creation additionally throws `Uspacy\SDK\Exceptions\MessageDuplicationException` on duplicate-key errors.

```
use Saloon\Exceptions\Request\RequestException;

try {
    $sdk->crm()->createDeal(['title' => 'New']);
} catch (RequestException $e) {
    $status = $e->getResponse()->status();
    $body = $e->getResponse()->json();
}
```

Development
-----------

[](#development)

```
composer install
composer test       # run the PHPUnit suite (Saloon MockClient, no network)
composer check-cs   # code style (ECS, PSR-12 + clean-code)
composer fix-cs     # auto-fix style
```

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance94

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~48 days

Recently: every ~59 days

Total

23

Last Release

30d ago

Major Versions

0.22.1-beta → 1.0.0-beta2026-04-29

PHP version history (2 changes)0.1PHP ^8.1

0.13-betaPHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/d9d5258e04fba1dfb0c01261eaab607c8ee95427b4b474bbcbbab7d9503d1f46?d=identicon)[NightWriter](/maintainers/NightWriter)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (23 commits)")[![NightWriter](https://avatars.githubusercontent.com/u/1132694?v=4)](https://github.com/NightWriter "NightWriter (21 commits)")[![nonamich](https://avatars.githubusercontent.com/u/21929069?v=4)](https://github.com/nonamich "nonamich (7 commits)")[![Parano9I](https://avatars.githubusercontent.com/u/76449533?v=4)](https://github.com/Parano9I "Parano9I (7 commits)")[![maus007](https://avatars.githubusercontent.com/u/24294378?v=4)](https://github.com/maus007 "maus007 (1 commits)")

---

Tags

externalapisdkcrmMessengeruspacy

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/uspacy-uspacy-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/uspacy-uspacy-php-sdk/health.svg)](https://phpackages.com/packages/uspacy-uspacy-php-sdk)
```

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.8k2.5k](/packages/unopim-unopim)[statamic/cms

The Statamic CMS Core Package

4.9k3.8M1.1k](/packages/statamic-cms)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

293.1k](/packages/eslazarev-wildberries-sdk)[scriptdevelop/whatsapp-manager

Paquete para manejo de WhatsApp Business API en Laravel

793.9k](/packages/scriptdevelop-whatsapp-manager)

PHPackages © 2026

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