tuhin18003/the-greet 问题修复 & 功能扩展

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

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

tuhin18003/the-greet

Composer 安装命令:

composer require tuhin18003/the-greet

包简介

Greeting based on time and with option to add name at the end of the line

README 文档

README

Greeting helper based on time of the day with the option to include the person’s name and formatted date.

Install

Via Composer

$ composer require tuhin18003/the-greet

Usage

Load via Composer autoload:

require './vendor/autoload.php';

It takes up to 2 parameters:

  1. Name (string) – The person’s name (optional, can be skipped).
  2. Date format (string) – PHP date format (optional). Skip this parameter to hide today’s date.

Example 1: With name and date

use Tuhin18003\Greet\Greet;

$Greet = new Greet();

echo $Greet->hello('Jon Doe', 'l F j, Y');

Output:

Good morning Jon Doe. Rise and shine! A new day brings new opportunities. Today is Tuesday January 3, 2023.

Example 2: With name only

echo $Greet->hello('Alice');

Output:

Good afternoon Alice. Keep going — the best is yet to come!

Example 3: Without name or date

echo $Greet->hello();

Output:

Good evening. Take a moment to reflect and breathe. You’ve done great.

Features

  • Smart time-based greetings – Messages adapt based on the current hour (00–23).
  • 👤 Personalized greetings – Optionally add a person’s name.
  • 📅 Custom date output – Choose your own date format (using PHP date formats).
  • 💡 Inspirational quotes – Each greeting comes with a motivational line.
  • 🔄 Consistent return – Use as a string or structured array depending on your needs.

Advanced Usage

If you need a structured array instead of plain text, pass $return_arr = true.

$response = $Greet->hello('Jon Doe', 'l F j, Y', true);

print_r($response);

Output:

Array
(
    [msg] => Good night
    [name] => Jon Doe
    [quote] => Rest well — tomorrow holds endless possibilities.
    [today] => Today is Tuesday January 3, 2023
)

Output Samples

  • Good morning Jon Doe. Rise and shine! A new day brings new opportunities. Today is Monday July 1, 2024.
  • Good evening Alice. Take a moment to reflect and breathe. You’ve done great.
  • Good night. Sleep well — endless possibilities await you.

Credentials

codesolz.net

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固