Download the PHP package mojahed/mparser without Composer

On this page you can find all versions of the php package mojahed/mparser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mparser

MParser - Powerful String Parsing Library

MParser is a PHP package that simplifies parsing complex strings with custom tokens and expressions. It allows you to effortlessly create and extend parsing functionality using a flexible trait-based architecture. Easily integrate MParser into your projects for efficient string processing and data extraction in a user-friendly manner.

Installation

You can install the MParser package using Composer. Run the following command:

Basic Usage

To use MParser, follow these steps:

  1. Import the necessary class: use Mojahed\MParser;

  2. Parse the string with the provided data:

Available Methods

MParser provides the following methods for parsing and replacing tokens in the input string:

exp

Splits the token and returns the value at the specified index.

Example:

!Note : exp doesn't supports (,) comma as first parameter

cut

Extracts a substring from the token based on the start and length specified.

Example:

cut_back

Extracts a substring from the end of the token based on the length specified.

Example:

reverse

Reverses the characters of the token.

Example:

sum

Adds the specified number to the token (assumed to be numeric).

Example:

sub

Subtracts the specified number from the token (assumed to be numeric).

Example:

mul

Multiplies the token with the specified number (assumed to be numeric).

Example:

div

Divides the token by the specified number (assumed to be numeric). Returns 0 if the divisor is zero.

Example:

power

Raises the token to the power of the specified number (assumed to be numeric).

Example:

upper

Converts the token to uppercase.

Example:

lower

Converts the token to lowercase.

Example:

capitalize

Capitalizes the first character of the token while converting the rest to lowercase.

Example:

replace

Replaces occurrences of the search string with the replacement string in the token.

Example:

length

Returns the length of the token (number of characters).

Example:

concat

Concatenates the token with the specified string.

Example:

Multiple Expression

Use multiple expression at a time.

Example:

Custom Methods

You can add your own custom methods to extend the functionality of MParser. Simply create a new class that inherits from MParser and define your custom methods. For example:

By creating the ChildParser class and defining the _reverse method, you can now use [reverse()] in your input string to call the custom method.

Contributing

If you find any issues, have suggestions, or want to add new features, feel free to create an issue or submit a pull request on GitHub.

License

This package is open-source and available under the MIT License. Feel free to use and modify it according to your needs.


All versions of mparser with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mojahed/mparser contains the following files

Loading the files please wait ....