PHPackages                             divineomega/php-hcl-parser - 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. divineomega/php-hcl-parser

Abandoned → [jord-jd/php-hcl-parser](/?search=jord-jd%2Fphp-hcl-parser)Library

divineomega/php-hcl-parser
==========================

PHP HCL Parser

v2.0.0(1mo ago)1418.5k↓100%3[1 PRs](https://github.com/Jord-JD/php-hcl-parser/pulls)LGPL-3.0-onlyPHPPHP ^7.4 || ^8.0

Since Apr 10Pushed 1mo agoCompare

[ Source](https://github.com/Jord-JD/php-hcl-parser)[ Packagist](https://packagist.org/packages/divineomega/php-hcl-parser)[ GitHub Sponsors](https://github.com/DivineOmega)[ RSS](/packages/divineomega-php-hcl-parser/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

⚒🔀🐘 PHP HCL Parser
==================

[](#-php-hcl-parser)

[![Build Status](https://camo.githubusercontent.com/666d788da0b2db9ded732d51b5161d6c2a47ad1b6352bcb72869a674861f9e2a/68747470733a2f2f7472617669732d63692e6f72672f4a6f72642d4a442f7068702d68636c2d7061727365722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Jord-JD/php-hcl-parser)[![Coverage Status](https://camo.githubusercontent.com/a42c04efc6e9b62cb85b1e563f29bc205ad8fc91f2af48ec933fcb05cbe39c7e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4a6f72642d4a442f7068702d68636c2d7061727365722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/Jord-JD/php-hcl-parser?branch=master)[![StyleCI](https://camo.githubusercontent.com/2998f742560a8379ddd4faa39d7c6edbe5c5f3e62e3940b312baaef38c220437/68747470733a2f2f7374796c6563692e696f2f7265706f732f3132383935313634332f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/128951643)

HCL is a configuration language make by HashiCorp. HCL files are used by several HashiCorp products, including Terraform.

This library parses HCL configuration files into PHP objects.

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

[](#installation)

You can install the PHP HCL Parser library using Composer. Just run the following command from the root of your project.

```
composer require jord-jd/php-hcl-parser

```

Usage
-----

[](#usage)

To parse HCL into a PHP object, create a new `HCLParser` object, passing it the HCL (as a string), then call the `parse` method. See the example below.

```
$hcl = file_get_contents('example.tf');
$configObject = (new HCLParser($hcl))->parse();
```

The resulting object will look similar to the following.

```
object(stdClass)#5 (2) {
  ["provider"]=>
  array(1) {
    [0]=>
    object(stdClass)#4 (1) {
      ["aws"]=>
      array(1) {
        [0]=>
        object(stdClass)#2 (3) {
          ["access_key"]=>
          string(17) "${var.access_key}"
          ["region"]=>
          string(13) "${var.region}"
          ["secret_key"]=>
          string(17) "${var.secret_key}"
        }
      }
    }
  }
  ["resource"]=>
  array(1) {
    [0]=>
    object(stdClass)#8 (1) {
      ["aws_instance"]=>
      array(1) {
        [0]=>
        object(stdClass)#7 (1) {
          ["example"]=>
          array(1) {
            [0]=>
            object(stdClass)#6 (2) {
              ["ami"]=>
              string(12) "ami-2757f631"
              ["instance_type"]=>
              string(8) "t2.micro"
            }
          }
        }
      }
    }
  }
}
```

###  Health Score

56

—

FairBetter than 98% of packages

Maintenance93

Actively maintained with recent releases

Popularity32

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 90.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 ~955 days

Total

4

Last Release

36d ago

Major Versions

v1.2.0 → v2.0.02026-02-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/c580cdf7c14898fff179cdfc1085892091d5d2f49d917873a12365af9ac77c93?d=identicon)[Jord-JD](/maintainers/Jord-JD)

---

Top Contributors

[![Jord-JD](https://avatars.githubusercontent.com/u/650645?v=4)](https://github.com/Jord-JD "Jord-JD (30 commits)")[![Binternet](https://avatars.githubusercontent.com/u/438361?v=4)](https://github.com/Binternet "Binternet (3 commits)")

---

Tags

configurationhclparserphp-libraryphp-objectterraform

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/divineomega-php-hcl-parser/health.svg)

```
[![Health](https://phpackages.com/badges/divineomega-php-hcl-parser/health.svg)](https://phpackages.com/packages/divineomega-php-hcl-parser)
```

PHPackages © 2026

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