定制 antonchaikin/f3-timezone 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

antonchaikin/f3-timezone

最新稳定版本:v1.0.3

Composer 安装命令:

composer require antonchaikin/f3-timezone

包简介

Fat-Free Framework plugin to detect and set PHP timezone based on request headers, query, or body parameters.

README 文档

README

Fat-Free Framework plugin to detect and set PHP timezone based on request data.

This plugin checks for timezone information in the incoming request (HEADERS, GET, POST, COOKIE, SESSION) and sets it globally using date_default_timezone_set().

💡 Installation

Require via Composer:

composer require antonchaikin/f3-timezone

Or add manually to composer.json:

"require": {
  "antonchaikin/f3-timezone": "^1.0"
}

🚀 Usage

In your index.php:

use F3Timezone\TimezonePlugin;

$f3 = \Base::instance();

// Register the plugin
TimezonePlugin::register();

// Set timezone from request
$f3->updateTimezone();

📦 What it does

  • Searches for a timezone value in:
    • HEADERS
    • GET
    • POST
    • COOKIE
    • SESSION
  • Accepts only valid PHP timezones
  • Automatically applies it using date_default_timezone_set(...)

✅ Example

If a client sends this header:

Timezone: Europe/Warsaw

The plugin will detect it and call:

date_default_timezone_set('Europe/Warsaw');

📝 License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-28