Download the PHP package baumrock/humandates without Composer

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

HumanDates

HumanDates is a PHP library that provides convenient methods for formatting dates as human-readable strings and generating human-friendly date ranges. It uses the IntlDateFormatter class to ensure accurate localization and formatting based on the specified locale.

image

Usage

To get started, include the HumanDates library and create a new instance:

Why Use HumanDates?

HumanDates provides several benefits and reasons to consider using it in your PHP projects:

  1. Simplified Date Formatting

    HumanDates simplifies the process of formatting dates in PHP. It offers a straightforward and intuitive API for formatting both single dates and date ranges, eliminating the need for complex and error-prone manual formatting.

  2. Localization Support

    HumanDates leverages the IntlDateFormatter class, ensuring accurate localization of date formats based on the specified locale. This allows you to generate date strings that are culturally appropriate and easily understood by users from different regions.

  3. Customizable Date Range Formats

    With HumanDates, you have the flexibility to define custom format patterns for date ranges. You can easily tailor the output to match your specific requirements, such as including or excluding certain date components, adjusting separators, or changing the order of elements.

  4. Replacement for Deprecated strftime()

    As of PHP 8, the strftime() function is deprecated and will be removed in PHP 9. HumanDates can serve as a replacement for strftime(), providing a modern and reliable alternative for formatting dates in PHP.

  5. MIT License

    HumanDates is released under the permissive MIT License, allowing you to freely use, modify, and distribute the library in your projects, both personal and commercial.

By using HumanDates, you can enhance the user experience by presenting dates in a human-readable format, improve code maintainability, and ensure consistent and accurate date formatting across your application.

Give HumanDates a try and simplify your date formatting needs with ease!

Formatting a Single Date

You can format a single date using the format() method, which can serve as a replacement for the strftime() function which is deprecated in PHP8 and will be removed in PHP9:

The format() method accepts a date string or timestamp as the first parameter and an optional format pattern as the second parameter. The format pattern follows the syntax defined by the IntlDateFormatter class: See here for a list of all available letters.

Formatting a Date Range

HumanDates provides a convenient way to format date ranges as well. Use the range() method by passing the start and end dates:

By default, the range() method uses predefined patterns to format the date range. However, you can also specify custom patterns by providing an array of patterns as the third parameter:

Note that this will set the patterns for this single request only! If you want to modify the globally used patterns you can do this:

Setting Locales

You can set the locale for date formatting either globally for the current HumanDates instance or on a per-format basis.

To set the locale globally, pass the desired locale as a parameter when creating a new HumanDates instance:

To set the locale for a specific format() call, include the locale parameter:

Setting Defaults

You can set default formatting options for your HumanDates instance by specifying the locale and format pattern during initialization:

Star the Repository

If you find HumanDates useful or interesting, please star the repository on GitHub. By starring the repository, you show your appreciation and support for the project. It also helps us understand the level of community interest and motivates us to further improve the library. ⭐


All versions of humandates with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
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 baumrock/humandates contains the following files

Loading the files please wait ....