contoweb/delivery-calculator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

contoweb/delivery-calculator

最新稳定版本:v1.1.2

Composer 安装命令:

composer require contoweb/delivery-calculator

包简介

Delivery calculator for Laravel to calculate a date time by providing the start date time and a duration in hours

README 文档

README

Calculate a DateTime by providing a start date-time and a duration in hours considering business hours, weekends and defined holidays.

Getting Started

The package is available on Packagist and GitHub:

Installing

With composer

composer require contoweb/delivery-calculator

Migrate holidays table

php artisan migrate

How to use

Load the class

use Contoweb\DeliveryCalculator\DeliveryCalculator;

Initialize business hours with start (eg. 05:45) and end time (eg. 23:00)

$deliveryCalculator = new DeliveryCalculator(5, 45, 23, 0);

Function 1: Calculate a delivery DateTime by given start DateTime (Carbon date) and the delivery duration (double in hours)

$deliveryDateTime = $deliveryCalculator->getDeliveryTime(Carbon::now(), $duration); 

Function 2: Given date (Carbon) is in business time?

$isBusinessTime = $deliveryCalculator->isBusinessTime(Carbon::now());

Define holidays

Enter a start_date (eg. 2017-12-24) and end_date (eg. 2017-12-26) into the holidays table to define holidays. For a single holiday just enter the same date for both fields.

Built With

Version

1.0

Authors

统计信息

  • 总下载量: 136
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-03