PHPackages                             nabeghe/atlin - 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. [Caching](/categories/caching)
4. /
5. nabeghe/atlin

ActiveLibrary[Caching](/categories/caching)

nabeghe/atlin
=============

A lightweight, high-performance key-value format parser/serializer with APCu, Redis and file-cache support.

v0.2.1(2mo ago)181MITPHPPHP &gt;=7.4

Since Feb 27Pushed 2mo agoCompare

[ Source](https://github.com/nabeghe/atlin-php)[ Packagist](https://packagist.org/packages/nabeghe/atlin)[ Docs](https://github.com/nabeghe/atlin-php)[ RSS](/packages/nabeghe-atlin/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (1)

Atlin
=====

[](#atlin)

[![PHP Version](https://camo.githubusercontent.com/7404ac2849f95f99ace60c4b949c4e57e3188dfc0d5df7a913378138ac571fb6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344372e342d626c7565)](https://php.net)[![License: MIT](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](LICENSE)

A lightweight, high-performance **key-value format** parser and serializer for PHP.
Designed for translation files — but works great for any structured text data.

---

The Atlin Format
----------------

[](#the-atlin-format)

Atlin is a plain-text key-value format with minimal syntax and maximum readability.

### Rules

[](#rules)

RuleBehaviour`@key` at line startDeclares a key. Everything after `@` on that line is the key name.Line(s) after key (not starting with `@`)The value for that key. Multi-line values are supported.Exactly **one** blank line before a `@` lineIgnored — used as a visual separator between entries.**More than one** blank line before a `@` lineAll except the last are part of the value.Blank line(s) at end of fileAlways ignored (treated as file-ending whitespace).Text before any keyAssigned to the empty-string key `""`.`@` alone on a lineProduces the empty-string key `""`.Duplicate keysValues are **concatenated** with a newline (`\n`).`\@` at line startEscaped — treated as a literal `@` in the value.`\#` at line startEscaped — treated as a literal `#` in the value (when comments enabled).`@` not at line startAlways part of the value (e.g. email addresses).`@` with a leading space (e.g. ` @foo`)Part of the value, NOT a key.### Blank Line Behaviour (Important)

[](#blank-line-behaviour-important)

The blank line rule is precise:

```
@key
value

@next

```

→ Single blank line = separator → `key = "value"` ✅

```
@key
value

@next

```

→ Two blank lines = first is value content, second is separator → `key = "value\n"` ✅

```
@key
value

@next

```

→ Three blank lines = first two are value content, last is separator → `key = "value\n\n"` ✅

```
@key
value

```

→ Trailing blank line at EOF = ignored → `key = "value"` ✅

### Full Example

[](#full-example)

```
@app.name
My Awesome App

@app.description
This is a multi-line
description of the app.

@button.save
Save

@button.cancel
Cancel

@email.signature
Best regards,
The Team

\@this is not a key, it is a value without a preceding key declaration

@note
Send feedback to support@example.com

```

Parsed result:

```
[
    'app.name'        => 'My Awesome App',
    'app.description' => "This is a multi-line\ndescription of the app.",
    'button.save'     => 'Save',
    'button.cancel'   => 'Cancel',
    'email.signature' => "Best regards,\nThe Team",
    ''                => '@this is not a key, it is a value without a preceding key declaration',
    'note'            => 'Send feedback to support@example.com',
]
```

### Duplicate Keys (Concatenation)

[](#duplicate-keys-concatenation)

```
@terms
By using this app you agree to our terms.

@terms
Updated: January 2026.

```

Result:

```
[
    'terms' => "By using this app you agree to our terms.\nUpdated: January 2026.",
]
```

### Why Atlin?

[](#why-atlin)

- **Human-readable** — no quotes, no special delimiters, no indentation rules.
- **Multi-line values** — just keep writing on the next lines.
- **Precise blank line control** — one blank = separator, more = content.
- **Zero noise** — trailing blank lines at EOF are always ignored.
- **Unicode-safe** — key names can be any Unicode string (Persian, Arabic, CJK, etc.).
- **Fast** — single O(n) pass parser with zero regex.

---

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

[](#installation)

```
composer require nabeghe/atlin
```

Requires **PHP ≥ 7.4**.

---

Quick Start
-----------

[](#quick-start)

```
use Nabeghe\Atlin\Atlin;

$atlin = new Atlin();

// Parse a string
$data = $atlin->parse("@hello\nHello, World!");
echo $data['hello']; // Hello, World!

// Parse a file
$data = $atlin->parseFile(__DIR__ . '/lang/en.atlin');

// Serialize an array back to Atlin format
$text = $atlin->serialize([
    'greeting' => 'Hi!',
    'farewell' => 'Bye!',
]);
```

---

Caching
-------

[](#caching)

Atlin supports three cache backends. Caching is **disabled by default** — enable it by passing an `AtlinConfig` with a cache driver.

### File Cache (recommended for most apps)

[](#file-cache-recommended-for-most-apps)

Stores the parsed PHP array as a plain `
