PHPackages                             cleantalk/contacts-encoder - 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. cleantalk/contacts-encoder

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

cleantalk/contacts-encoder
==========================

CleanTalk ContactsEncoder class

2.0.18(3mo ago)01.2k↑350%GPL-3.0-or-laterPHPCI passing

Since Mar 30Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/CleanTalk/contacts-encoder)[ Packagist](https://packagist.org/packages/cleantalk/contacts-encoder)[ RSS](/packages/cleantalk-contacts-encoder/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (8)Versions (23)Used By (0)

Contacts Encoder - Quick Start Guide
====================================

[](#contacts-encoder---quick-start-guide)

Overview
--------

[](#overview)

The Contacts Encoder protects email addresses and phone numbers from spam bots. It requires **4 essential components** to work properly.

🚀 Complete Setup in 4 Steps
---------------------------

[](#-complete-setup-in-4-steps)

### Step 1: PHP Backend Setup

[](#step-1-php-backend-setup)

#### 1.1 Configure Parameters (Params)

[](#11-configure-parameters-params)

```
use Cleantalk\Common\ContactsEncoder\Dto\Params;

$params = new Params();
$params->api_key = 'your_cleantalk_api_key';  // REQUIRED for encryption
$params->obfuscation_mode = Params::OBFUSCATION_MODE_BLUR;
$params->do_encode_emails = true;
$params->do_encode_phones = true;
$params->is_logged_in = false;  // Set true for admin users
```

#### 1.2 Create Platform-Specific Class

[](#12-create-platform-specific-class)

```
use Cleantalk\Common\ContactsEncoder\ContactsEncoder as BaseEncoder;

class YourPlatformContactsEncoder extends BaseEncoder
{
    // REQUIRED: Add request validation
    protected function checkRequest()
    {
        // Anti-Spam protection for $_POST here
        return true;
    }

    // OPTIONAL: Customize messages
    protected function getTooltip()
    {
        return 'Click to decode protected contact';
    }
}
```

### Step 2: Encoding Content

[](#step-2-encoding-content)

```
// Initialize encoder
$encoder = YourPlatformContactsEncoder::getInstance($params);

// Process your content
$protectedHtml = $encoder->runEncoding($yourHtmlContent);

// Output to browser
echo $protectedHtml;
```

### Step 3: Frontend Assets

[](#step-3-frontend-assets)

#### 3.1 Include CSS

[](#31-include-css)

```

```

#### 3.2 Include JavaScript

[](#32-include-javascript)

```

```

### Step 4: JavaScript Configuration

[](#step-4-javascript-configuration)

#### 4.1 Create Config Object

[](#41-create-config-object)

```
const encoderConfig = {
    // REQUIRED: AJAX endpoint
    decodeContactsRequest: (encodedNodes) => {
        return fetch('/your-ajax-endpoint', {
            method: 'POST',
            body: encodedNodes
        }).then(r => r.json());
    },

    // OPTIONAL: Custom texts
    texts: {
        waitForDecoding: 'Decoding contact...',
        gotIt: 'Continue',
        blocked: 'Access denied'
    },

    serviceData: {
        brandName: 'Your Site Name'
    }
};
```

### 4.2 Initialize on Frontend

[](#42-initialize-on-frontend)

```
document.addEventListener('DOMContentLoaded', () => {
    new ContactsEncoder(encoderConfig);
});
```

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance79

Regular maintenance activity

Popularity20

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 64.9% 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 ~57 days

Recently: every ~23 days

Total

20

Last Release

109d ago

Major Versions

1.0.0 → 2.0.02025-11-08

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5357627?v=4)[CleanTalk](/maintainers/CleanTalk)[@CleanTalk](https://github.com/CleanTalk)

---

Top Contributors

[![Glomberg](https://avatars.githubusercontent.com/u/8588152?v=4)](https://github.com/Glomberg "Glomberg (24 commits)")[![AntonV1211](https://avatars.githubusercontent.com/u/39616556?v=4)](https://github.com/AntonV1211 "AntonV1211 (6 commits)")[![alexandergull](https://avatars.githubusercontent.com/u/45482252?v=4)](https://github.com/alexandergull "alexandergull (4 commits)")[![venera81](https://avatars.githubusercontent.com/u/220177689?v=4)](https://github.com/venera81 "venera81 (3 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/cleantalk-contacts-encoder/health.svg)

```
[![Health](https://phpackages.com/badges/cleantalk-contacts-encoder/health.svg)](https://phpackages.com/packages/cleantalk-contacts-encoder)
```

###  Alternatives

[symfony/lock

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

514139.2M693](/packages/symfony-lock)[cuyz/valinor

Dependency free PHP library that helps to map any input into a strongly-typed structure.

1.5k13.2M174](/packages/cuyz-valinor)[igorw/compose

Function composition.

8424.8k](/packages/igorw-compose)[eduarguz/shift-php-cs

PHP CS Fixer - Laravel Coding Style Ruleset

1147.6k46](/packages/eduarguz-shift-php-cs)

PHPackages © 2026

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