parsica-php / parsica
The easiest way to build robust parsers in PHP.
Fund package maintenance!
turanct
Installs: 93 314
Dependents: 4
Suggesters: 0
Security: 0
Stars: 413
Watchers: 11
Forks: 16
Open Issues: 19
Requires
- php: ^7.4 || ^8.0
- ext-mbstring: *
Requires (Dev)
- ext-json: *
- mathiasverraes/uptodocs: dev-main
- phpbench/phpbench: ^1.0.1
- phpunit/phpunit: ^9.0
- psr/event-dispatcher: ^1.0
- vimeo/psalm: ^4.30
This package is auto-updated.
Last update: 2025-07-09 10:24:03 UTC
README
The easiest way to build robust parsers in PHP.
composer require parsica-php/parsica
Documentation & API: parsica-php.github.io
<?php $parser = between(char('{'), char('}'), atLeastOne(alphaChar())); $result = $parser->tryString("{Hello}"); echo $result->output(); // Hello
Quality
The code is entirely built with Test-Driven Development, and type-checked with Psalm. It is likely bug-free or very close to it. It is suitable for complex parsing requirements, and could even be used to build a programming language. However, it might not be performant enough if you use it at a high scale.
Project Maintenance & Support
Regrettably, the maintainer of this library (@turanct) has passed away in December 2021 due to cancer. The original author @mathiasverraes is now the maintainer again, and is doing occasional minor updates. If you'd like to contribute to this library, or if you wish to use this library for a project and need consulting, contact Mathias via mathias at verraes net. PR and issues submissions may not be monitored.
Development
After running composer install
, run these to validate if everything is in working order:
composer run phpunit
composer run psalm
composer run uptodocs
# or all of them:
composer run test
As this library uses pure functional programming, it may be hard to wrap your head around if you're used to object-oriented or imperative styles. Our recommendation is to familiarize yourself with the basics of functional programming, for example by reading an intro to Haskell.