Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jubianchi/ppc
A parser combinator library for PHP
https://github.com/jubianchi/ppc
parser-combinators php
Last synced: 20 days ago
JSON representation
A parser combinator library for PHP
- Host: GitHub
- URL: https://github.com/jubianchi/ppc
- Owner: jubianchi
- License: mit
- Created: 2020-07-20T08:06:07.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-11-07T16:05:42.000Z (about 2 years ago)
- Last Synced: 2024-10-03T12:38:18.970Z (about 1 month ago)
- Topics: parser-combinators, php
- Language: PHP
- Homepage: https://jubianchi.github.io/ppc/
- Size: 282 KB
- Stars: 34
- Watchers: 4
- Forks: 1
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# PPC
> A parser combinator library for PHP
Simple to use & extend • Fast & lightweight • Reliable
## Introduction
PPC stands for **P**HP **P**arser **C**ombinator. What an obvious name for such a library!
As its name tells us, PPC is just another parser combinator library with a clear goal: make writing efficient parsers a
breeze. Writing parser with PPC does not require you to know how parser combinators works internally nor it requires you
to learn a complex object-oriented API.PPC is a set of functions which you will love to compose to build complex parsers!
## Installation
PPC requires you to have at least PHP `7.4.0` and the [Multibyte String](https://www.php.net/manual/en/book.mbstring.php)
(`mbstring`) extension enabled. You may want to check if your setup is correct using the following script:```bash
#!/usr/bin/env bashecho "PHP version: $(php -v | head -n1 | grep -qE '7.([4-9]|1[0-9]).(0|[1-9][0-9]*)' && echo '✅' || echo '❌')"
echo "Multibyte String extension: $(php -m | grep -qE 'mbstring' && echo '✅' || echo '❌')"
```Once everything is correct, choose the installation method that best feets your needs:
### Composer (CLI)
```bash
composer require "jubianchi/ppc" "dev-master"
```### Composer (JSON)
```json
{
"require": {
"jubianchi/ppc": "dev-master"
}
}
```### Git
```bash
git clone "https://github.com/jubianchi/ppc.git"
git checkout "master"
```## Example parser
Here is a quick example demonstrating how easy it is to write a parser:
```php