Download the PHP package dpolocalbrycej/php-unstructured-text-parser without Composer
On this page you can find all versions of the php package dpolocalbrycej/php-unstructured-text-parser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dpolocalbrycej/php-unstructured-text-parser
More information about dpolocalbrycej/php-unstructured-text-parser
Files in dpolocalbrycej/php-unstructured-text-parser
Package php-unstructured-text-parser
Short Description A PHP Class to help extract text out of documents that are not structured in a processing friendly manner
License MIT
Homepage https://github.com/DPOLocalBryceJ/php-unstructured-text-parser
Informations about the package php-unstructured-text-parser
Unstructured Text Parser [PHP]
About this Class
This is a PHP Class to help extract text out of documents that are not structured in a processing friendly way. When you want to parse text out of form generated emails for example you can create a template matching the expected incoming mail format while specifying the variable text elements and leave the rest for the class to extract your preformatted variables out of the incoming mails' body text.
Useful when you want to parse data out of:
- Emails generated from web forms
- Documents with definable templates / expressions
Installation
1- Using composer simply run the following:
2- Clone / Copy the files from this repository to your local libs directory:
Usage example
Parsing Procedure
1- Grab a single copy of the text you want to parse.
2- Replace every single varying text within it to a named variable in the form of {%VariableName%}
3- Add the templates file into the templates directory (defined in parsing code) with a txt extension fileName.txt
4- Pass the text you wish to parse to the parse method of the class and let it do the magic for you.
Template Example
If the text documents you want to parse looks like this:
Then your Template file (example_template.txt
) should be:
The output of a successful parsing job would be: