2017 © Pedro Peláez
 

library php-util

PHP utility library.

image

wells5609/php-util

PHP utility library.

  • Saturday, April 11, 2015
  • by wells5609
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

PHP-Util

PHP utility function library., (*1)

About

  • No userland dependencies
  • Windows and developer friendly

Why

I found myself re-implementing the same helper functions/methods over and over again. I decided to stop doing that and created this library instead., (*2)

Packages

The "packages" are just groupings of alike functions., (*3)

A non-exhaustive listing:, (*4)

Arrays

Many array_*() functions, e.g.: * array_pull() * array_key() (get a key by relative position) * array_map_keys() (like array_map() but for keys) * array_filter_keys() (like array_filter() but for keys), (*5)

Array "dot-notation": * array_get() * array_set() * array_unset() * array_isset(), (*6)

e.g., (*7)

$a = array("some" => array("item" => array("key" => 1)));
array_get($a, "some.item.key") // returns "1"

String

Several str_*() functions, such as: * str_endswith() and str_startswith() (with case-sensitive option) * str_sentences() (sentence extractor) * str_alnum() (strip non-alphanumeric characters) * str_numeric() (detects and casts numeric strings to float or int), (*8)

URL-safe Base64 encoding and decoding: * base64_url_encode() * base64_url_decode(), (*9)

Simple common inflectors: * str_pear_case() (e.g. "Some_String_Like_This") * str_snake_case() (e.g. "some_string_like_this") * str_studly_case() (e.g. "SomeStringLikeThis") * str_camel_case() (e.g. "someStringLikeThis"), (*10)

Format

String formatting functions: * str_format() (generic string formatter) * hash_format() (e.g. for inserting "-" into UUIDs) * phone_format() (detects format based on length) * bytes_format() (option for SI or IEC), (*11)

Sanitize/Validate

Wrappers for common uses of filter_var(): * sanitize() * validate(), (*12)

Filesystem

  • is_abspath()
  • joinpath()
  • globr() (recursive glob())
  • scandirr() (recursive scandir())

CSV

  • file_get_csv()
  • file_put_csv()
  • csv2array()

XML

  • xml_write_document()
  • xml_write_element()
  • xml2array()

Callables

  • result()
  • invoke() (matches named or ordered parameters to a callable function signature)
  • callable_id() (human-readable callable identifiers)

Misc

  • is_xml()
  • is_json()
  • is_serialized()
  • object_to_array() (no more *prop => ugly from casting to array)
  • define_safe() (define a constant only if undefined)
  • pdo_dsn() (creates a DSN string for PDO drivers)

The Versions

11/04 2015

2.0.x-dev

2.0.9999999.9999999-dev https://github.com/wells5609/PHP-Util

PHP utility library.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Avatar wells

helpers extension utility common utilities

12/09 2014

dev-master

9999999-dev https://github.com/wells5609/PHP-Util

Commonly used helpers and utilities for PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

by The Developer

helpers utility common utilities