phariscope/safephp 问题修复 & 功能扩展

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

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

phariscope/safephp

最新稳定版本:1.0.3

Composer 安装命令:

composer require phariscope/safephp

包简介

A PHP library complementary to SafePHP containing currently unsupported functions.

README 文档

README

A set of core PHP functions rewritten to throw exceptions instead of returning false when an error is encountered.

These functions complement those of the excellent SafePHP tool https://github.com/thecodingmachine/safe.

Installation

composer require phariscope/safephp

Usage

use function SafePHP\boolval;
use function SafePHP\floatval;
use function SafePHP\intval;
use function SafePHP\strval;

use function SafePHP\hash_file;

use function SafePHP\getenv;
use function SafePHP\getenvOrWithENV;

$value = boolval(1); // return true
$value = floatval("123.456"); // return 123.456
$value = intval("123"); // return 123
$value = strval(1); // return "1"

$value = hash_file("md2", $filename); // return a string like "080bf15137e26254e9cd8870b68aec86"

$value = getenv('PWD'); // return string of current PWD
$value = getenv(); // return array of all getenv (be carreful some $_ENV may hav been forgotten) 

$value = getenvOrWithENV('PWD'); // return string of current PWD even if it is in $_ENV only

To Contribute to phariscope/SafePHP

Requirements

  • docker
  • git

Install

Unit test

bin/phpunit

Using Test-Driven Development (TDD) principles (thanks to Kent Beck and others), following good practices (thanks to Uncle Bob and others).

Quality

  • phpcs PSR12
  • phpstan level 9
  • coverage 100%
  • infection MSI >99%

Quick check with:

./codecheck

Check coverage with:

bin/phpunit --coverage-html var

and view 'var/index.html' with your browser

Check infection with:

bin/infection

and view 'var/infection.html' with your browser

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-15