PHPackages                             sergeybruhin/nano-crm-client - 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. sergeybruhin/nano-crm-client

ActiveLibrary[API Development](/categories/api)

sergeybruhin/nano-crm-client
============================

Plain PHP API client for nano-crm-api

v0.0.1(1mo ago)051MITPHPPHP ^8.3

Since May 26Pushed 1mo agoCompare

[ Source](https://github.com/sergeybruhin/nano-crm-client)[ Packagist](https://packagist.org/packages/sergeybruhin/nano-crm-client)[ RSS](/packages/sergeybruhin-nano-crm-client/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (2)Versions (2)Used By (1)

nano-crm-client
===============

[](#nano-crm-client)

Plain PHP HTTP client for [nano-crm-api](https://github.com/sergeybruhin/nano-crm-api) — a self-hosted lead and contact management service.

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

[](#requirements)

- PHP 8.3+
- Guzzle 7.x

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

[](#installation)

```
composer require sergeybruhin/nano-crm-client
```

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

[](#quick-start)

```
use NanoCrm\Client\NanoCrmClient;
use NanoCrm\Client\Dto\CreateLeadInput;

$client = NanoCrmClient::create(
    baseUrl: 'http://nano-crm-api',
    token:   'your-service-token',
    timeout: 10,
);

$lead = $client->leads()->create(new CreateLeadInput(
    contact: ['full_name' => 'Ivan Petrov', 'phone' => '+79001234567'],
    source:  'example.com',
    type:    'callback',
));

echo $lead->uuid;
```

The client appends `/api/v1/` to `baseUrl` and attaches `Authorization: Bearer {token}` on every request.

Leads
-----

[](#leads)

All lead methods are accessible via `$client->leads()` and return `LeadDto` instances.

```
$leads = $client->leads();

// Create
$lead = $leads->create(new CreateLeadInput(
    contact: ['full_name' => 'Ivan Petrov', 'phone' => '+79001234567'],
    source:  'example.com',
    type:    'callback',
    form:    ['page' => '/contacts'],   // optional
    utm:     ['utm_source' => 'google'], // optional
    meta:    ['ip' => '1.2.3.4'],       // optional
    formKey: 'callback-v2',             // optional
    isTest:  false,
    sentAt:  new DateTimeImmutable(),   // optional
));

// Find
$lead = $leads->find('019602a0-0000-7000-8000-000000000001');

// Update
$lead = $leads->update($lead->uuid, new UpdateLeadInput(source: 'acme.example.com'));

// Delete (soft)
$leads->delete($lead->uuid);
```

Contacts
--------

[](#contacts)

All contact methods are accessible via `$client->contacts()` and return `ContactDto` instances.

```
$contacts = $client->contacts();

// Create
$contact = $contacts->create(new CreateContactInput(
    fullName:           'Ivan Petrov',
    primaryPhoneNumber: '+79001234567',
    primaryEmail:       'ivan@example.com', // optional
));

// Find
$contact = $contacts->find('019602a0-0000-7000-8000-000000000002');

// Update
$contact = $contacts->update($contact->uuid, new UpdateContactInput(
    primaryEmail: 'newemail@example.com',
));

// Delete (soft)
$contacts->delete($contact->uuid);
```

DTOs
----

[](#dtos)

### `CreateLeadInput`

[](#createleadinput)

PropertyTypeRequired`contact``array{full_name: string, phone: string}`Yes`source``string`Yes`type``string`Yes`form``array|null`No`utm``array|null`No`meta``array|null`No`formKey``string|null`No`isTest``bool`No (default `false`)`sentAt``DateTimeInterface|null`No### `LeadDto`

[](#leaddto)

PropertyType`uuid``string``type``string``source``string``isTest``bool``sentAt``DateTimeImmutable``createdAt``DateTimeImmutable``updatedAt``DateTimeImmutable``contact``ContactDto|null``utm``UtmDto|null``remoteIds``array|null``form``array|null``meta``array|null``formKey``string|null`### `ContactDto`

[](#contactdto)

PropertyType`uuid``string``fullName``string``firstName``string|null``lastName``string|null``middleName``string|null``primaryPhoneNumber``string|null``primaryEmail``string|null``remoteIds``array|null``createdAt``DateTimeImmutable``updatedAt``DateTimeImmutable`Exception handling
------------------

[](#exception-handling)

All exceptions extend `NanoCrm\Client\Exceptions\NanoCrmException`.

ExceptionHTTP statusNotes`AuthenticationException`401Invalid or missing service token`NotFoundException`404Resource does not exist or was soft-deleted`UnprocessableException`422Validation errors — call `$e->errors()``NanoCrmException`otherGeneric API error```
use NanoCrm\Client\Exceptions\AuthenticationException;
use NanoCrm\Client\Exceptions\NotFoundException;
use NanoCrm\Client\Exceptions\UnprocessableException;
use NanoCrm\Client\Exceptions\NanoCrmException;

try {
    $lead = $client->leads()->find($uuid);
} catch (NotFoundException $e) {
    // 404 — not found or deleted
} catch (UnprocessableException $e) {
    $errors = $e->errors(); // array
} catch (AuthenticationException $e) {
    // 401 — check token
} catch (NanoCrmException $e) {
    // other API error
}
```

License
-------

[](#license)

MIT

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance88

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

59d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/08a6c60ed6a4cdd9dc4104bac89bd503265c085b15e530eb8616cc78b01db33c?d=identicon)[SergeyBruhin](/maintainers/SergeyBruhin)

---

Top Contributors

[![sergeybruhin](https://avatars.githubusercontent.com/u/8505172?v=4)](https://github.com/sergeybruhin "sergeybruhin (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sergeybruhin-nano-crm-client/health.svg)

```
[![Health](https://phpackages.com/badges/sergeybruhin-nano-crm-client/health.svg)](https://phpackages.com/packages/sergeybruhin-nano-crm-client)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.3M47](/packages/tencentcloud-tencentcloud-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

293.1k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)[aimeos/prisma

A powerful PHP package for integrating media related Large Language Models (LLMs) into your applications

1943.1k5](/packages/aimeos-prisma)[volcengine/volcengine-php-sdk

118.7k](/packages/volcengine-volcengine-php-sdk)

PHPackages © 2026

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