PHPackages                             dynoser/helml - 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. dynoser/helml

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

dynoser/helml
=============

PHP implementation of the HELML class without dependencies

v1.0.2(2y ago)0573Apache-2.0PHPPHP &gt;=5.6

Since Dec 21Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/dynoser/phpHELML)[ Packagist](https://packagist.org/packages/dynoser/helml)[ RSS](/packages/dynoser-helml/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

HELML
=====

[](#helml)

[![helml-logo](https://github.com/dynoser/HELML/raw/master/logo/icon.png)](https://github.com/dynoser/HELML/raw/master/logo/icon.png)

PHP package
-----------

[](#php-package)

- [PHP Source code -- phpHELML](https://github.com/dynoser/phpHELML)
- [HELML format definition (en)](https://github.com/dynoser/HELML/blob/master/docs/README-HELML_en.md)
- [Описание формата HELML (ru)](https://github.com/dynoser/HELML/blob/master/docs/README-HELML_ru.md)

Implementations
---------------

[](#implementations)

- [HELML on Python](https://github.com/dynoser/HELML/blob/master/Python)
- [HELML on JavaScript](https://github.com/dynoser/HELML/blob/master/JavaScript)
- [HELML Visual Studio Code plugin](https://github.com/dynoser/HELML/blob/master/helml-vscode-plugin)

Installation (PHP)
==================

[](#installation-php)

To install HELML, simply use composer:

```
composer require dynoser/helml
```

or, You may copy and use files directly:

```
use dynoser\HELML\HELML;  # it means that the HELML class is in the namespace "dynoser\HELML"
use dynoser\HELML\fileHELMLsect; # it means that the fileHELMLsect class is in the namespace "dynoser\HELML"
require_once "src/HELML.php"; // specify the correct path to file
require_once 'src/fileHELMLsect.php';// or use "autoload.php" from composer to autoload
```

Usage
=====

[](#usage)

This package contains two independent classes:

- class `HELML` - encoder/decoder HELML-format
- class `fileHELMLsect` - selective data-section loader from HELML file

class HELML
===========

[](#class-helml)

Here's a quick example of how to use the `HELML` class:

```
use dynoser\HELML\HELML;
require_once 'src/HELML.php'; // path to HELML.php file, or require "autoload.php"

# Example data structure

$data = [
    "key1" => "value1",
    "key2" => [1, 2, 3],
    "key3" => [
        "nested_key" => "nested_value"
    ]
];

# Encode the data structure into a HELML string
$encoded_data = HELML::encode($data);
print_r($encoded_data)

# Decode the HELML string back into a data structure
$decoded_data = HELML::decode($encoded_data);
```

encoded\_data:

```
key1: value1

key2:
 :--:  1
 :--:  2
 :--:  3

key3
 :nested_key: nested_value
```

Features
========

[](#features)

Encode and decode data arrays to/from HELML.

API
===

[](#api)

### **`HELML::encode`**($arr, $url\_mode=False)

[](#helmlencodearr-url_modefalse)

Encode a data array into a HELML string.

- **$arr** The input data array to be encoded.
- **$url\_mode** (bool, optional): A boolean indicating if the URL mode should be used. Defaults to False.

Returns:

- string: The encoded HELML string.

### **`HELML::decode`**($src\_rows)

[](#helmldecodesrc_rows)

Decode a HELML formatted string or list of strings into a nested dictionary.

- **$src\_rows** The HELML input as a string or strings-array.

Returns:

- Array: The decoded nested array.

Class fileHELMLsect
===================

[](#class-filehelmlsect)

This class implements selective loading of sections from a file in HELML format.

```
use dynoser\HELML\fileHELMLsect;

require_once 'src/fileHELMLsect.php';// path to file, or require "autoload.php"

/*
For example, we have file "testdata.helml" contained this:

A:
 :X: 1
 :Y: 2
# Comment before section
B
 :X: 5
 :Y: 6

Core
 :Test: data
 :Nested key: value
C:
 # This is a Comment string
 :Other: data

DD: DD-Value
D: D-value
E: is E
F:
 :nested:
  ::--: First
  ::--: Second

*/

fileHELMLsect::$add_section_comments = false; // switch off auto-comments

$encoded_data = fileHELMLsect::Load('testdata.helml', ['B:', 'C', 'D']);

print_r($encoded_data)
```

Result string:

```
B
:X: 5
:Y: 6
C:
:Other: data
D: D-value
```

In result we got data only from 'B', 'C' and 'D' sections, without comments and empty-lines

In this way, it is very convenient to get sections from the root level.

You can get nested keys in exactly the same way, however, it should be remembered that we will get these structures without the structures in which they are located.

For example, we can get ':nested' key from previous example file, and we got:

```
$encoded_data = fileHELMLsect::Load('testdata.helml', [':nested']);

print_r($encoded_data);
```

Result:

```
:nested:
::--: First
::--: Second
```

The parsing of this sample will be as follows:

```
(
    [nested] => Array
        (
            [0] => First
            [1] => Second
        )

)
```

Note:

- Specifying "`:`" at the end of the section name is optional. Inside these colons are removed.
- All the level colons at the beginning need to be specified if we want to get a non-root level section.
- Parameter `$only_first_occ`, which allows you to get all occurrences of the listed sections, if there are several of them in the file

By setting the `$only_first_occ` parameter to `false`, you can extract all variants of the values of some nested key. For example, let's get all the values of the nested key X from the examples above:

```
$encoded_data = fileHELMLsect::Load('testdata.helml', [':Y'], false);

print_r($encoded_data);
```

Result:

```
:Y: 2
:Y: 6
```

Independence
------------

[](#independence)

- Note that both classes `HELML` and `fileHELMLsect` do not have any dependencies and can be used independently of each other.

See also:
---------

[](#see-also)

- plugin "HELML" for Visual Studio Code
- Try online [HELML plugin](https://marketplace.visualstudio.com/items?itemName=dynoser.helml) in [vscode.dev](https://vscode.dev)

License
=======

[](#license)

This project is licensed under the Apache-2 License.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance45

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

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

Total

2

Last Release

871d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2576177031670dbafd68b9a03031ca81f0b9e45f0d6244c2cfc2e12cf2d312b9?d=identicon)[dynoser](/maintainers/dynoser)

---

Tags

jsonarrayserializeyamlserializationHELML

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dynoser-helml/health.svg)

```
[![Health](https://phpackages.com/badges/dynoser-helml/health.svg)](https://phpackages.com/packages/dynoser-helml)
```

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k394.3M1.5k](/packages/nette-utils)[cuyz/valinor

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

1.5k9.2M108](/packages/cuyz-valinor)[jbzoo/data

An extended version of the ArrayObject object for working with system settings or just for working with data arrays

891.6M23](/packages/jbzoo-data)[zakirullin/mess

Convenient array-related routine &amp; better type casting

21228.9k2](/packages/zakirullin-mess)[ptrofimov/matchmaker

Ultra-fresh PHP matching functions

27167.7k](/packages/ptrofimov-matchmaker)[armincms/json

A Laravel Nova field.

25149.4k3](/packages/armincms-json)

PHPackages © 2026

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