huenisys / parsers
collection of file parsers
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/huenisys/parsers
Requires
- erusev/parsedown: ^1.7
- symfony/yaml: ^4.2
Requires (Dev)
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2025-09-29 02:14:46 UTC
README
Simple parsers
Supported
- Markdown (parses to html)
- Yaml (parses to php object)
Usage
use huenisys\Parsers\Yaml; use huenisys\Parsers\Markdown; /** @test **/ public function simple_yaml_is_parsed() { $this->assertEquals(['title' => 'Some Title'], Yaml::parseText('title: Some Title')); } /** @test **/ public function yaml_file_is_parsed() { $filePath = __DIR__.'/../test-files/hello.yaml'; $this->assertEquals(['hello' => 'world'], Yaml::parseFile($filePath)); } /** @test **/ public function simple_md_is_parsed() { $this->assertEquals('<h1>hello</h1>', Markdown::parseText('# hello')); $this->assertEquals('<h2>hello</h2>', Markdown::parseText('## hello')); } /** @test **/ public function md_file_is_parsed() { $filePath = __DIR__.'/../test-files/hello.md'; $this->assertEquals('<h1>hello world</h1>', Markdown::parseFile($filePath)); }