insight-media/statamic-opening-hours 问题修复 & 功能扩展

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

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

insight-media/statamic-opening-hours

Composer 安装命令:

composer require insight-media/statamic-opening-hours

包简介

A Statamic addon to manage and display opening hours

README 文档

README


Insight Media Logo

Statamic Opening hours

Set your business' opening hours and exceptional closing times in the Statamic control panel.

Display or query the opening hours in your antler views using the provided openingHours tag.

Features

  • Adds an 'opening hours' page to the CP navigation, where you can define multiple opening hours per weekday
  • Add exceptional closing times, which override the default opening hours
  • Display the opening hours using the provided tag
  • Query for open/close status
  • Query for next/previous opening hours/closing times
  • Uses the Spatie Opening Hours package to perform queries

How to Install

You can search for this addon in the Tools > Addons section of the Statamic control panel and click install, or run the following command from your project root:

composer require insight-media/statamic-opening-hours

Publish the optional config file.

php artisan vendor:publish --tag=statamic-google-opening-hours-config --force

How to Use

In the Statamic Control Panel

Set your business' opening hours in the Statamic control panel.

In your antlers templates

Use the openingHours tag to display or query opening hours:

Check if currently open:

{{ if {openingHours:isOpen} }}
    We are open
{{ /if }}

Check if currently closed:

{{ if {openingHours:isClosed} }}
    We are closed
{{ /if }}

Check if open on specific weekday:

{{ if {openingHours:isOpen on="tuesday"} }}
    We are open on tuesday
{{ /if }}

Check if open on specific date:

{{ if {openingHours:isOpen on="2022-12-31"} }}
    We are open on 2022-12-31
{{ /if }}

Check if open at specific time:

{{ if {openingHours:isOpen at="2022-12-31 15:00:00"} }}
    We are open on 2022-12-31 at 15:00:00
{{ /if }}

Check if closed on specific weekday:

{{ if {openingHours:isClosed on="monday"} }}
    We are closed on monday
{{ /if }}

Check if closed on specific date:

{{ if {openingHours:isClosed on="2023-01-02"} }}
    We are closed on 2023-01-02
{{ /if }}

Check if closed at specific time:

{{ if {openingHours:isClosed at="2022-12-31 22:00:00"} }}
    We are closed on 2022-12-31 at 22:00:00
{{ /if }}

Query opening times for specific weekday:

{{ openingHours:forDay day="monday" format="H:i" }} 
    <div>{{ from }}-{{ to }}</div> 
{{ /openingHours:forDay }}

Query opening times for all weekdays:

{{ openingHours:forWeek format="H:i" }}
    {{ day }}: {{ hours }} <div>{{ from }}-{{ to }}</div> {{ /hours }}<br>
{{ /openingHours:forWeek }}

Query opening times for specific date:

{{ openingHours:forDate date="2022-12-14" format="H:i" }}
    <div>{{ from }}-{{ to }}</div> 
{{ /openingHours:forDate }}

Query exceptional closing times:

{{ openingHours:exceptions format="H:i" }}
    {{ day }} {{ hours }} from {{ from }}-{{ to }} {{ /hours }} {{ if reason }}({{ reason }}){{ /if }}<br>
{{ /openingHours:exceptions }}

Get next opening times

{{ openingHours:nextOpen date="{now format='Y-m-d H:i:s'}" format="Y-m-d H:i:s" }}

Get next closing times

{{ openingHours:nextClose date="{now format='Y-m-d H:i:s'}" format="Y-m-d H:i:s" }}

Get previous closing times

{{ openingHours:previousOpen date="{now format='Y-m-d H:i:s'}" format="Y-m-d H:i:s" }}

Get the amount of open time (number of hours as a floating number) between 2 dates/times.

{{ openingHours:diffInOpenHours from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}

Get the amount of open time (number of minutes as a floating number) between 2 dates/times.

{{ openingHours:diffInOpenMinutes from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}

Get the amount of open time (number of seconds as a floating number) between 2 dates/times.

{{ openingHours:diffInOpenSeconds from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}

Get the amount of closed time (number of hours as a floating number) between 2 dates/times.

{{ openingHours:diffInClosedHours from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}

Get the amount of closed time (number of minutes as a floating number) between 2 dates/times.

{{ openingHours:diffInClosedMinutes from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}

Get the amount of minutes until opening time.

{{ openingHours:diffInClosedMinutes from="{now format='Y-m-d H:i:s'}" to="{ openingHours:nextOpen date="{now format='Y-m-d H:i:s'}" format="Y-m-d H:i:s" }" }}

Get the amount of closed time (number of seconds as a floating number) between 2 dates/times.

{{ openingHours:diffInClosedSeconds from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}

Important: We recommend using the Antlers runtime parser when working with the openingHours tag.

insight-media/statamic-opening-hours 适用场景与选型建议

insight-media/statamic-opening-hours 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 226 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 12 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「addon」 「statamic」 「opening hours」 「Insight Media」 「Opening times」 「Closing times」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 insight-media/statamic-opening-hours 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 insight-media/statamic-opening-hours 我们能提供哪些服务?
定制开发 / 二次开发

基于 insight-media/statamic-opening-hours 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-12-15