PHPackages                             lastdragon-ru/text-parser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. lastdragon-ru/text-parser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

lastdragon-ru/text-parser
=========================

Yet another package to simplify writing fast and memory-effective parsers that can parse infinite strings.

11.1.0(1mo ago)081MITPHPPHP ^8.4|^8.5

Since Jan 17Pushed 1mo agoCompare

[ Source](https://github.com/LastDragon-ru/text-parser)[ Packagist](https://packagist.org/packages/lastdragon-ru/text-parser)[ Docs](https://github.com/LastDragon-ru/php-packages)[ RSS](/packages/lastdragon-ru-text-parser/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (14)Versions (7)Used By (1)

Text Parser
===========

[](#text-parser)

There are several tools to generate full-featured parsers even for PHP[1](#user-content-fn-1-321d1be22fd4cbeae01cf81ea148fef0). They are overkill when you just need to parse something simple. In such cases, you might decide to create your own parser. There are a lot of articles/examples on the web, and actually it is not too difficult as you may think. This is yet another package to simplify writing fast and memory-effective parsers that can parse infinite strings.

Requirements
============

[](#requirements)

RequirementConstraintSupported byPHP`^8.5``HEAD ⋯ 11.0.0``^8.4``HEAD ⋯ 9.2.0``^8.3``10.3.0 ⋯ 9.2.0`Installation
============

[](#installation)

```
composer require lastdragon-ru/text-parser
```

Introduction
============

[](#introduction)

As an example, I will show how to create a parser for mathematical expressions like `2 - (1 + 2) / 3` and how to calculate them as a bonus.

```
