PHPackages                             constpb/amo-placeholder - 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. constpb/amo-placeholder

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

constpb/amo-placeholder
=======================

The library is designed for working with placeholders of custom fields of AmoCRM entity models, needed to make dynamic message text

1.0.0(4mo ago)02MITPHPPHP &gt;=8.1

Since Feb 4Pushed 4mo agoCompare

[ Source](https://github.com/constpb2394/amo-placeholder)[ Packagist](https://packagist.org/packages/constpb/amo-placeholder)[ Docs](https://github.com/constpb/amo-placeholder)[ RSS](/packages/constpb-amo-placeholder/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (2)Used By (0)

Lib purposes
------------

[](#lib-purposes)

Main purpose of this lib is to provide functionality of creating text messages for client mailing, depending on given AmoCRM entity models.

Amo model supported
-------------------

[](#amo-model-supported)

- LeadModel
- ContactModel

How to use
----------

[](#how-to-use)

### Localization

[](#localization)

Before use set necessary localization (at now supported only en and ru).

```
LocaleService::setLocale('ru');
```

### Basic usage

[](#basic-usage)

```
$this->typeFactory = new CommonTypeFactory(); // creates inner representation of AmoCRM custom fields

$this->handlerFactory = new HandlerFactory($this->logger); // creates handler decides placeholder of given custom field looks like
$this->placeholderFactory = new PlaceholderFactory(); // creates placeholder of given custom field representing entity (like 'Lead') and name (like 'Name of lead')

$this->placeholderBuilder = new CommonPlaceholderBuilder($this->logger, $this->handlerFactory, $this->placeholderFactory); // creates an array of placeholders strings of given entity type

$this->customFieldMapper = new CustomFieldMapper($this->logger); // creates an inner representation of AmoCRM custom fields from Amocrm custom field model
$this->entityMapperFactory = new CommonEntityMapperFactory( $this->typeFactory, $this->logger); // creates an inner representation of AmoCRM entity from Amocrm entity model
$this->replacer = new CommonReplacer($this->logger, $this->handlerFactory, $this->placeholderFactory); // creates an array with placeholders values as key and model values as values

/**
 * parses given string template with placeholders and substitutes given model values
 */
$this->templateProcessor = new MessageTemplateProcessorService(
    $this->logger,
    $this->placeholderBuilder,
    $this->customFieldMapper,
    $this->entityMapperFactory,
    $this->replacer
);

$contactCustomFields = $amocrmClient->customFields(EntityTypesInterface::CONTACTS)->get();

$placeholders = $this->templateProcessor->getVariables(EntityTypeEnum::CONTACT, $contactCustomFields) // managers may choose placeholders from list during client message creation

// then

$contact = new ContactModel();
$contact->setName('John');

$template = 'Hello, {{Contact / Name of contact}}!';

$message = $this->templateProcessor->replaceVariables($template, $contact); // results in Hello, John!
```

### Explanations

[](#explanations)

1. If there is no value for given placeholder, it will be replaced with empty string.
2. Placeholders pattern consists of entity type and field name divided by '/' like {{Lead / Custom field name}}, so it may result in string of Lead entity even if there is no custom field named 'Custom field name' if `getVariables` method is used with type Lead but custom fields of Contact entity.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance74

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 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

149d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/39743582?v=4)[Kostya Bronshteyn](/maintainers/constpb2394)[@constpb2394](https://github.com/constpb2394)

---

Top Contributors

[![constpb2394](https://avatars.githubusercontent.com/u/39743582?v=4)](https://github.com/constpb2394 "constpb2394 (7 commits)")

---

Tags

textplaceholderamo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/constpb-amo-placeholder/health.svg)

```
[![Health](https://phpackages.com/badges/constpb-amo-placeholder/health.svg)](https://phpackages.com/packages/constpb-amo-placeholder)
```

###  Alternatives

[symfony/lock

Creates and manages locks, a mechanism to provide exclusive access to a shared resource

514139.2M689](/packages/symfony-lock)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

564576.7k52](/packages/ecotone-ecotone)[grasmash/expander

Expands internal property references in PHP arrays.

14064.3M10](/packages/grasmash-expander)[civicrm/civicrm-core

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

751291.4k43](/packages/civicrm-civicrm-core)[illuminate/broadcasting

The Illuminate Broadcasting package.

7127.2M208](/packages/illuminate-broadcasting)

PHPackages © 2026

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