ramazancetinkaya/seconds-converter

A PHP library to convert seconds into minutes, hours, and days.

1.0.0 2024-04-11 10:57 UTC

This package is auto-updated.

Last update: 2024-10-11 11:56:53 UTC


README

License GitHub issues GitHub stars GitHub forks

Seconds Converter is a PHP library designed to simplify the conversion of seconds into various time units such as minutes, hours, and days. It provides a convenient and easy-to-use interface for developers to integrate time conversion functionality into their projects.

Table of Contents

Installation

Composer

You can install the library via Composer, a dependency manager for PHP. Make sure you have Composer installed on your system. If not, you can follow the official installation guide.

  1. Open your terminal or command prompt.

  2. Navigate to your project directory.

  3. Run the following command to add Seconds Converter to your project's dependencies:

    composer require ramazancetinkaya/seconds-converter

Composer will download and install the library and its dependencies into your project's vendor directory.

Manual Installation

If you prefer not to use Composer, you can manually include the library in your project:

  1. Download: Download the latest release from the GitHub releases page.
  2. Extract: Extract the downloaded ZIP file.
  3. Copy Files: Copy the contents of the src directory into your project's desired location.

Usage

<?php

require_once 'vendor/autoload.php'; // If installed via Composer

use ramazancetinkaya\SecondsConverter;

// Create an instance of the converter
$converter = new SecondsConverter();

try {
    echo $converter->convert(123456); // Output: "1 days, 10 hours, 17 minutes, 36 seconds"
} catch (InvalidArgumentException $e) {
    echo "Error: " . $e->getMessage();
}

?>

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or create a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright

© 2024 Ramazan Çetinkaya. All rights reserved.