承接 douglasgreen/utility 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

douglasgreen/utility

最新稳定版本:v0.5.1

Composer 安装命令:

composer require --dev douglasgreen/utility

包简介

PHP utility project for exception classes and wrapper functions

README 文档

README

A PHP utility project for exception classes and wrapper functions

Setup

Add the project with Composer.

composer require douglasgreen/utility

Benefits

PHP has an old core design dating back to its PHP 3 era. Examples include:

  • Using functions instead of classes.
  • Returning mixed types from functions.
  • Returning false, null, or empty array to supress errors.
  • Inconsistent function names and arguments.
  • Returning arrays or resources from functions instead of objects.
  • A mixture of mutable arguments and return values.

Even worse, the language introduced static typing and strict type checking tools.

  • Returning false|string doesn't make sense and should return ?string.
  • Type checkers force you to work harder to ignore errors using strict comparisons.

These utility classes wrap the PHP function calls and try to fix these problems.

Function signatures

The functions were renamed for clarity. Function argument order was preserved, except:

  • Mutable arguments are now return values on getter functions.
  • If a signal value is returned, return null rather than false.
  • Arrays with multiple shapes and types were reduced to a single shape and type.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-07