{"id":15984877,"url":"https://github.com/divineomega/php-hcl-parser","last_synced_at":"2026-02-13T22:39:00.255Z","repository":{"id":56969677,"uuid":"128951643","full_name":"DivineOmega/php-hcl-parser","owner":"DivineOmega","description":"⚒🔀🐘 Parses HCL configuration files into PHP objects.","archived":false,"fork":false,"pushed_at":"2020-03-23T09:13:31.000Z","size":31,"stargazers_count":14,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T01:18:13.478Z","etag":null,"topics":["configuration","hcl","parser","php-library","php-object","terraform"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DivineOmega.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-10T15:04:40.000Z","updated_at":"2023-01-12T12:11:54.000Z","dependencies_parsed_at":"2022-08-21T10:50:52.333Z","dependency_job_id":null,"html_url":"https://github.com/DivineOmega/php-hcl-parser","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DivineOmega%2Fphp-hcl-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DivineOmega%2Fphp-hcl-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DivineOmega%2Fphp-hcl-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DivineOmega%2Fphp-hcl-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DivineOmega","download_url":"https://codeload.github.com/DivineOmega/php-hcl-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243869415,"owners_count":20361012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configuration","hcl","parser","php-library","php-object","terraform"],"created_at":"2024-10-08T02:10:58.790Z","updated_at":"2026-02-13T22:39:00.194Z","avatar_url":"https://github.com/DivineOmega.png","language":"PHP","readme":"# ⚒🔀🐘 PHP HCL Parser\n\n[![Build Status](https://travis-ci.org/DivineOmega/php-hcl-parser.svg?branch=master)](https://travis-ci.org/DivineOmega/php-hcl-parser)\n[![Coverage Status](https://coveralls.io/repos/github/DivineOmega/php-hcl-parser/badge.svg?branch=master)](https://coveralls.io/github/DivineOmega/php-hcl-parser?branch=master)\n[![StyleCI](https://styleci.io/repos/128951643/shield?branch=master)](https://styleci.io/repos/128951643)\n\nHCL is a configuration language make by HashiCorp. HCL files are used by several HashiCorp products,\nincluding Terraform.\n\nThis library parses HCL configuration files into PHP objects.\n\n## Installation\n\nYou can install the PHP HCL Parser library using Composer. Just run the following command\nfrom the root of your project.\n\n```\ncomposer require divineomega/php-hcl-parser\n```\n\n## Usage\n\nTo 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.\n\n```php\n$hcl = file_get_contents('example.tf');\n$configObject = (new HCLParser($hcl))-\u003eparse();\n```\n\nThe resulting object will look similar to the following.\n\n```php\nobject(stdClass)#5 (2) {\n  [\"provider\"]=\u003e\n  array(1) {\n    [0]=\u003e\n    object(stdClass)#4 (1) {\n      [\"aws\"]=\u003e\n      array(1) {\n        [0]=\u003e\n        object(stdClass)#2 (3) {\n          [\"access_key\"]=\u003e\n          string(17) \"${var.access_key}\"\n          [\"region\"]=\u003e\n          string(13) \"${var.region}\"\n          [\"secret_key\"]=\u003e\n          string(17) \"${var.secret_key}\"\n        }\n      }\n    }\n  }\n  [\"resource\"]=\u003e\n  array(1) {\n    [0]=\u003e\n    object(stdClass)#8 (1) {\n      [\"aws_instance\"]=\u003e\n      array(1) {\n        [0]=\u003e\n        object(stdClass)#7 (1) {\n          [\"example\"]=\u003e\n          array(1) {\n            [0]=\u003e\n            object(stdClass)#6 (2) {\n              [\"ami\"]=\u003e\n              string(12) \"ami-2757f631\"\n              [\"instance_type\"]=\u003e\n              string(8) \"t2.micro\"\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivineomega%2Fphp-hcl-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdivineomega%2Fphp-hcl-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivineomega%2Fphp-hcl-parser/lists"}