awesome-php
awesome-php copied to clipboard
Add T-Regx
Advanced library for Regular Expressions in PHP: https://t-regx.com/
It:
- Maps warnings, errors, flag errors, C-like errors (
preg_last_error()), return type values and other unexpected situations in PHP regular expressions to exceptions. - Fixes bugs and incosistencies (fixed in later versions of PHP or not at all)
- Prevents fatal errors from
preg_()methods (for example, by throwingInvalidArgumentException).
Additionally:
- Provides higher-level API for matching, replacing, spliting, validation.
- UTF8 support out of the box
- Removes false positives (in PHP regular expressions, missing group, unmatched group and matched empty string are identical, T-Regx distingushies them)
- Provides API for chained and multiple patterns.
- Provides patterns without delimiters, so
pattern('\d+'), instead ofpreg_match('/\d+/'); - Provides Prepared Patterns, an abstraction for building patterns with user data
- Functional interface
- More advanced methods, for example reacting to replacement not being done, optional matches, injecting strings into groups, etc.
About the project:
- PSR4 followed
- Semantic versioning
- PHP 7.1 and 8.1 compatible
- Composer installable
- Developed with real TDD in mind (you can see what I mean by "Real TDD" in Contributing.md)