Download the PHP package kachnitel/duration-bundle without Composer

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

DurationBundle

A Symfony bundle for handling duration parsing, formatting, and form integration. Parse human-readable duration strings (e.g., "2h 30m", "HH:MM:SS") and format seconds into readable formats.

Features

Installation

Install the bundle via Composer:

If you're not using Symfony Flex, enable the bundle in config/bundles.php:

Usage

1. Service Usage

The DurationUtil service provides static methods for duration manipulation:

2. Form Integration

Use DurationType in your forms to handle duration input:

In your entity, store the duration as an integer (seconds):

The form type automatically:

Supported Input Formats:

3. Twig Filters

Display durations in your templates using the provided Twig filters:

Advanced Configuration

Custom Unit Selection

You can specify which units to include when formatting:

Available Units

The bundle supports the following units (defined in DurationUtil::UNIT_CONFIG):

Unit Short Long Seconds
y y year/years 31,536,000
mo mo month/months 2,592,000
w w week/weeks 604,800
d d day/days 86,400
h h hour/hours 3,600
m m minute/minutes 60
s s second/seconds 1

Examples

Example 1: Time Tracking Application

Example 2: Task Estimation

Example 3: Service Layer

Requirements

Testing

Run the test suite:

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This bundle is released under the MIT License. See the LICENSE file for details.

Credits

Developed by Mr. Duck

Extracted from production code and open-sourced for the Symfony community.

Support

If you encounter any issues or have questions:

Changelog

1.0.0 (Initial Release)


All versions of duration-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
symfony/form Version ^6.4|^7.0
symfony/twig-bundle Version ^6.4|^7.0
twig/twig Version ^3.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 kachnitel/duration-bundle contains the following files

Loading the files please wait ...