Download the PHP package mducharme/date-formatter without Composer

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

Date Formatter

A simple service to format a date in constant format(s) across a PHP project / API.

Table of contents

How to install

PHP 7 is required. Install with composer:

How to use

Ready-to-use, with a Pimple container:

With the services directly:

The parser

In addition to the Formatter, a Parser service is also included. It has a single purpose, to ensure a mixed value, either a DateTime object or a parsable string, is parsed a DateTime object.

Any invalid string or parameter will throw an exception (\InvalidArgumentException) when parsing. Except null value, which are allowed by default but may be disallowed with a parameter to the parse() method. In thoses cases, null will be returned by the parse() method instead of a \DateTimeInterface object if it is allowed as a parameter.

Handling null:

As a single-purpose service, the Parser is also invokable and may be called directly:

The Formatter

The formatter is the main Service provided by this library. It has a single purpose, to render a DateTime object into a formatted string (or multiple formats).

As a single-purpose service, the Formatter is also invokable:

It comes with many formats by default. See the Formatter source file for details on the default format. You may get an array of all available formats by using Formatter::ALL as the format parameter:

It is possible to add custom formats, or overwrite default ones, by passing an optional array of formats to the Formatter constructor.

It is also possible to return an array of formatted dates, by specifying an array of formats:

Formats can either be a string, which will be formatted with DateTimeInterface::format() or a callback function with the following signature:

If no $format is provided to the format() method (2nd parameter), then the default one will be used. Setting the default format is possible with the constructor. It is optional and will default to the 'atom' format.

The Service Provider

As a convenience, a Pimple Service Provider is also included for an already bootstrapped parser (date/parser) and formatter (date/formatter).

To customize the options, the date/custom-formats and date/default-format container options can be extended.


All versions of date-formatter with dependencies

PHP Build Version
Package Version
Requires php Version ^7
pimple/pimple Version ^3.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 mducharme/date-formatter contains the following files

Loading the files please wait ....