kazeeem/laravel-flexible-countdown

This Laravel package allows you to create countdown timer on the go. It's very easy to use and understand and modify.

v1.0.1 2021-11-10 09:15 UTC

This package is auto-updated.

Last update: 2024-11-10 16:56:04 UTC


README


Flexible Countdown
Flexible Countdown (Laravel)

Flexible Countdown is a special countdown timer for Laravel built on DayJs Library.

made-with-javascript

Key FeaturesHow To UseCreditsLicense

Key Features

  • Locale support
    • You can specify the time in your timezone.
  • Action to perform when timer elapses
    • You could either display a message or reload the page when the time reaches zero.
  • Countdown in various formats. (i.e Year, months, weeks, days, hour, minutes and seconds.
  • Easy to modify.

How To Use

This package requires the use of Jquery 3.6.0 and above

# Install via Composer 
* composer require kazeeem/laravel-flexible-countdown

# Optional: The service provider will automatically get registered. Or you may manually add the service provider in your config/app.php file:
*   'providers' => [
        // ...
        Kazeeem\FlexibleCountdown\FlexibleCountdownServiceProvider::class,
    ];

# Publish the asset
$ Run this artisan command: 
* php artisan vendor:publish --tag=public --force

screenshot

You can create a countdown timer as it is in the sample above

However, there are some optional parameters you may want to use as well:

  • expiry_message
    • This is the message you may want to display when the timer reaches zero. If this value is not passed, the default message is "Time Up"
  • reload_page
    • This takes the value of true or false. It reloads the page when the countdown reaches zero.
  • suffix
    • This also takes the value of true or false. It will display the letters of the time beside the individual numbers
  • show_days
    • By default, the timer shows Hour, minutes and seconds but if you want it to show the value of remaining days, you can set this to true
  • show_weeks
    • If you want to show remaining weeks.
  • show_months
    • If you want to show remaining months.
  • show_years
    • If you want to show remaining year.
  • local
    • You can specify the timezone you want the counter to use. By default, it is set to Africa/Lagos.

Full Sample Code

screenshot

Credits

This countdown package uses the following library:

  • Dayjs and its plugins (Timezone and Duration).

License

MIT

codingkaz.com.ng  ·  GitHub @Kazeeem  ·  Twitter @Kazeeem_A