Download the PHP package neuron-php/formatting without Composer

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

CI codecov

Neuron-PHP Formatting

Formatters that turn raw values into currency, dates, times, and phone numbers. Each one implements Neuron\Formatters\IFormatter.

format() returns null when a date cannot be recognized.

Installation

Requires PHP 8.4 or higher and neuron-php/core.

Currency

Currency prints a symbol, pads the amount on the left, and formats it with sprintf. The defaults are $, nine characters of padding with _, and %01.2f (two decimal places).

Shorten the pad:

The setters return the formatter, so they can be chained. setFormat() changes the sprintf pattern used for the number.

Date

Date reads a date and prints it with PHP's date() format. The default format is Y-m-d.

The incoming date may use -, /, or . as the separator, in any of these orders:

When the first number could be either a month or a day, it is read as a month. 23/12/2024 is read as a day first, because 23 is not a month. A value that is not a date returns null.

setFormat() takes a PHP date format.

DateTime

DateTime normalizes the date the same way Date does, then formats the date and time together. The default format is Y-m-d g:i a.

A 12-hour clock with a meridian is accepted too: 23/12/2024 1:30 pm.

Time

Time formats a time of day. The default format is g:i a.

PhoneNumber

PhoneNumber strips everything that is not a digit, then formats by length.

Digits Result
7 123-4567
10 123-456-7890
More than 10 A leading +, the extra digits as a country code, then the last ten digits grouped as 2, 3, and 5
Anything else The digits, unchanged

More Information

License

MIT License - see LICENSE file for details


All versions of formatting with dependencies

PHP Build Version
Package Version
Requires ext-curl Version *
ext-json Version *
neuron-php/core Version 0.8.*
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 neuron-php/formatting contains the following files

Loading the files please wait ...