Download the PHP package donatj/printf-parser without Composer

On this page you can find all versions of the php package donatj/printf-parser. 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 printf-parser

Printf Parser

Latest Stable Version Total Downloads License ci.yml Scrutinizer Code Quality Code Coverage

PHP printf-syntax compatible printf string parser.

Parses printf strings into a stream of lexemes.

Requirements

Installing

Install the latest version with:

Example

Here is a simple example:

Output:

Documentation

Class: donatj\Printf\Parser

Parser implements a PHP Printf compatible Printf string parser.

Method: Parser->__construct

Parser constructor.

Parameters:

Method: Parser->parseStr

Parses a printf string and emit parsed lexemes to the configured Emitter

Class: donatj\Printf\LexemeEmitter


Method: LexemeEmitter->getLexemes

Return the Lexemes received by the emitter as an immutable LexemeCollection

Class: donatj\Printf\LexemeCollection

LexemeCollection is an immutable iterable collection of Lexemes with ArrayAccess


Method: LexemeCollection->getInvalid

Retrieve the first invalid Lexeme or null if all are valid.

This is useful for checking if a printf string parsed without error.


Method: LexemeCollection->toArray

Get the LexemeCollection as an ordered array of Lexemes

Returns:

Method: LexemeCollection->argTypes

Returns the list of expected arguments a 1-indexed map of the following
Returns:

Class: donatj\Printf\Lexeme

Lexeme represents a "basic" component of a printf string - either Literal Strings "!" or Invalid Lexemes

Method: Lexeme->__construct

LexItem constructor.


Method: Lexeme->getLexItemType

The type of the printf Lexeme


Method: Lexeme->getVal

The text of the lexeme


Method: Lexeme->getPos

The string position of the given lexeme

Class: donatj\Printf\ArgumentLexeme

Method: ArgumentLexeme->__construct

ArgumentLexeme constructor.

LexItem constructor.


Method: ArgumentLexeme->getArg

The position specifier, such as %3$s would return 3 and %s would return null

Returns:

Method: ArgumentLexeme->getShowPositive

Is the "Prefix positive numbers with a plus sign +" flag enabled


Method: ArgumentLexeme->getPadChar

Specified pad character flag

Returns:

Method: ArgumentLexeme->getPadWidth

Specified pad width

Returns:

Method: ArgumentLexeme->getLeftJustified

Is left-justification flag enabled?


Method: ArgumentLexeme->getPrecision

The Lexeme's indicated precision.

Returns:

Method: ArgumentLexeme->argType

Returns based on the type of argument one of the following

ArgumentLexeme::ARG_TYPE_MISSING
ArgumentLexeme::ARG_TYPE_INT
ArgumentLexeme::ARG_TYPE_DOUBLE
ArgumentLexeme::ARG_TYPE_STRING


Method: ArgumentLexeme->getLexItemType

The type of the printf Lexeme


Method: ArgumentLexeme->getVal

The text of the lexeme


Method: ArgumentLexeme->getPos

The string position of the given lexeme


All versions of printf-parser 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 donatj/printf-parser contains the following files

Loading the files please wait ....