Download the PHP package diqa/formatter without Composer

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

README

The formatting library diqa/formatter eases formatted text output in multiple columns on the console.

Features:

Quick start

First, you have to initialize the formatter with a configuration.

The only required option for the config object is the first parameter: column width. All others are optional. In the given example we have a 3-column layout with left alignment for the first column, center alignment for the second and right alignment for the 3rd. We also opted-in borderPadding.

Now you can use it. You either print one row or an array of rows.[1]

One row:

Multiple rows:

Options

The config class has the following constructor parameters:

Additionally, the following methods are available:

Alignments

While left, center and right alignments are quite self-explanatory, left-right alignment might not be. It means that a single column consists of two parts. First part is aligned left, second right. Example:

You cannot use a two column layout for this because in 1st row the first column overlaps the second column in the 3rd row.

Columns consisting of two parts are entered as arrays with two entries. So be careful: There are 3 arrays nesting. first is the rows, second the columns (actually only one here) and 3rd is the columns consisting of two parts.

Remarks

Word wrapping

The algorithm to break columns in multiple lines tries to preserve word boundaries. Only if it does not find any whitespaces in the column's text, it does hard line feeds at the last possible character.

Footnotes

[1] Please note that one input row does not necessarily output to one row. Text could be broken down into several lines to fit the column widths.

[2] Please note that it usually does not make sense to output a single line in this case because the border boundaries at top and bottom are added as well.


All versions of formatter with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.0
composer/installers Version 1.*,>=1.0.1
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 diqa/formatter contains the following files

Loading the files please wait ....