sentgine/helper 问题修复 & 功能扩展

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

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

sentgine/helper

最新稳定版本:v1.0.1

Composer 安装命令:

composer require sentgine/helper

包简介

A PHP library providing various helper functions for common tasks.

README 文档

README

License Latest Stable Version Total Downloads

Helper is PHP library providing various helper functions for common tasks.

Features

  • String Helper Class: Word: The package includes a versatile string manipulation helper class called Word. This class provides a wide range of methods for transforming and manipulating strings, such as converting strings to various casing formats (e.g., PascalCase, kebab-case, snake_case, camelCase, Title Case), extracting substrings, concatenating strings, performing regular expression matches and replacements, converting strings to lowercase or uppercase, trimming whitespace, checking for substring presence, singularizing and pluralizing English words, and more. With the Word class, you can streamline common string operations and enhance the efficiency of your PHP projects.

Requirements

  • PHP 8.0 or higher.

Installation

(1) You can install the package via Composer by running the following command:

composer require sentgine/helper:^1.0

Sample Usage of Sentgine\Helper\Word

Below are some examples demonstrating the usage of the Sentgine\Helper\Word class for string manipulation operations.

Basic Usage

use Sentgine\Helper\Word;

// Create a new instance of Word
$word = Word::of('hello world');

// Convert to PascalCase
$result = $word->pascalCase();
// Output: HelloWorld
echo $result;

// Convert to kebab-case
$result = $word->kebabCase();
// Output: hello-world
echo $result;

// Convert to snake_case
$result = $word->snakeCase();
// Output: hello_world
echo $result;

// Convert to camelCase
$result = $word->camelCase();
// Output: helloWorld
echo $result;

// Convert to Title Case
$result = $word->titleCase();
// Output: Hello World
echo $result;

// Sample method chaining
$result = Word::of('hello world')
    ->pascalCase() // Convert to PascalCase
    ->kebabCase()  // Convert to kebab-case
    ->snakeCase()  // Convert to snake_case
    ->camelCase()  // Convert to camelCase
    ->titleCase(); // Convert to Title Case

// Output: Hello World
echo $result;

Changelog

Please see the CHANGELOG file for details on what has changed.

Security

If you discover any security-related issues, please email sentgine@gmail.com instead of using the issue tracker.

Credits

Helper is built and maintained by Adrian Navaja.

  • Check out some cool tutorials and stuff on YouTube!
  • Catch my latest tweets and updates on Twitter (formerly X)!
  • Let's connect on a more professional note over on LinkedIn!
  • For more information about me and my work, visit my website: sentgine.com.

License

The MIT License (MIT). Please see the LICENSE file for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-04-12