Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
U

Utils

> 编程语言
Open source

Collection of useful PHP functions, mini-classes, and snippets for every day.

816 stars0 likes3 views
WebsiteGitHub

About

Collection of useful PHP functions, mini-classes, and snippets for every day.

JBZoo / Utils

  • Install
    • Usage
      • Smart functions
      • JBZoo\Utils\Arr
      • JBZoo\Utils\Cli
      • JBZoo\Utils\Csv
      • JBZoo\Utils\Dates
      • JBZoo\Utilsmail
      • JBZoo\Utilsnv
      • JBZoo\Utils\FS
      • JBZoo\Utils\Filter
      • JBZoo\Utils\Http
      • JBZoo\Utils\IP
      • JBZoo\Utils\Image
      • JBZoo\Utils\PhpDocs
      • JBZoo\Utils\Ser
      • JBZoo\Utils\Slug
      • JBZoo\Utils\Stats
      • JBZoo\Utils\Str
      • JBZoo\Utils\Sys
      • JBZoo\Utils\Timer
      • JBZoo\Utils\Url
      • JBZoo\Utils\Vars
      • JBZoo\Utils\Xml
    • Links (ideas and some functions)
    • Unit tests and check code style
    • License
    • See Also

Collection of PHP functions, mini classes and snippets for everyday developer's routine life.

Install

bash
composer require jbzoo/utils

Usage

Smart functions

php
use function JBZoo\Utils\alias;
use function JBZoo\Utils\alpha;
use function JBZoo\Utils\alphanum;
use function JBZoo\Utils\bool;
use function JBZoo\Utils\digits;
use function JBZoo\Utils\float;
use function JBZoo\Utils\int;

int(' 10.0 ') === 10;
float(' 10.0 ') === 10.0;

bool(' yes ') === true;
bool(' no ') === false;
bool('1') === true;
bool('0') === false;

alias('Qwer ty') === 'qwer-ty';
digits('Qwer 1 ty2') === '12';
alpha('Qwer 1 ty2') === 'Qwerty';
alphanum(' #$% Qwer 1 ty2') === 'Qwer1ty2';

JBZoo\Utils\Arr

…

JBZoo\Utils\Cli

…

JBZoo\Utils\Csv

php
Csv::parse(string $csvFile, string $delimiter = ';', string $enclosure = '"', bool $hasHeader = true): array; // Simple parser for CSV files.

JBZoo\Utils\Dates

…

JBZoo\Utils\Email

…

JBZoo\Utils\Env

…

JBZoo\Utils\FS

…

JBZoo\Utils\Filter

…

JBZoo\Utils\Http

…

JBZoo\Utils\IP

php
IP::getNetMask(string $ipAddress): ??string; // Return network mask. For example, '192.0.0.0' => '255.255.255.0'.

// Returns the IP address of the client.
//                         ONLY use if your server is behind a proxy that sets these values
IP::getRemote(bool $trustProxy = false): string;

IP::v4InRange(string $ipAddress, string $range): bool; // Check if a given ip is in a network.

JBZoo\Utils\Image

…

JBZoo\Utils\PhpDocs

php
// Simple parse of PHPDocs.
// Example or return value
//  [
//      'description' => 'Simple parse of PHPDocs. Example or return value',
//      'params'      => [
//          'param'  => ['string $phpDoc'],
//          'return' => ['array']
//      ]
//  ].
PhpDocs::parse(string $phpDoc): array;

JBZoo\Utils\Ser

…

JBZoo\Utils\Slug

…

JBZoo\Utils\Stats

…

JBZoo\Utils\Str

…

JBZoo\Utils\Timer

php
Timer::format(float $milliSeconds): string; // Formats the elapsed time as a string.

Timer::formatMS(float $seconds): string; // Formats the elapsed time as a string.

Timer::getRequestTime(): float; // Get request time in microseconds.

Timer::timeSinceStart(): float; // Formats the elapsed time since the start of the request as a string.

JBZoo\Utils\Url

…

JBZoo\Utils\Vars

…

JBZoo\Utils\Xml

…

Links (ideas and some functions)

  • utilphp - https://github.com/brandonwamboldt/utilphp
  • PHPBinString - https://github.com/Grandt/PHPBinString
  • URLify for PHP - https://github.com/jbroadway/urlify
  • LinkifyURL Project https://github.com/jmrware/LinkifyURL
  • http://www.phpexperts.pro
  • http://stackoverflow.com/a/11709412/430062
  • http://stackoverflow.com/questions/8321620/array-unique-vs-array-flip
  • http://shiflett.org/blog/2006/mar/server-name-versus-http-host
  • https://github.com/joomla-framework/string
  • Askar (ARACOOL) https://github.com/ARACOOOL
  • Sebastian Bergmann https://github.com/sebastianbergmann/php-timer
  • Sebastian Bergmann https://github.com/sebastianbergmann/environment
  • Oscar Otero https://github.com/oscarotero/env

Unit tests and check code style

bash
make
make test-all

License

MIT

See Also

  • CI-Report-Converter - Converting different error reports for deep compatibility with popular CI systems.
  • Composer-Diff - See what packages have changed after composer update.
  • Composer-Graph - Dependency graph visualization of composer.json based on mermaid-js.
  • Mermaid-PHP - Generate diagrams and flowcharts with the help of the mermaid script language.
  • Image - Package provides object-oriented way to manipulate with images as simple as possible.
  • Data - Extended implementation of ArrayObject. Use files as config/array.
  • Retry - Tiny PHP library providing retry/backoff functionality with multiple backoff strategies and jitter support.
  • SimpleTypes - Converting any values and measures - money, weight, exchange rates, length, ...

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHParray-manipulationsenviromentjbzoophp

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言