Download the PHP package hxgf/x-utilities without Composer
On this page you can find all versions of the php package hxgf/x-utilities. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hxgf/x-utilities
More information about hxgf/x-utilities
Files in hxgf/x-utilities
Package x-utilities
Short Description A collection of utility functions to help do things faster with PHP.
License MIT
Homepage https://github.com/jyoungblood/x-utilities
Informations about the package x-utilities
X-Utilities
A collection of standalone utility functions to help do things faster with PHP.
Installation
Easy install with composer:
Usage
x::email_send($parameters)
Sends a plain text or html email using the native PHP mail() function.
Messages can be sent using the Mailgun API if Mailgun credentials are available as environment variables like this:
or in your project's .env
file:
x::client_ip()
Returns the address of the computer making the current request.
x::url_slug($string)
Returns a lowercase URL-safe version of a given string, substituting -
for spaces and punctuation.
x::url_strip($url)
Removes the protocol and trailing slashes from a given url, returning only the domain name.
x::url_validate($url)
Returns a valid URL, adding http://
if needed.
x::br2nl($string)
The opposite of nl2br()
, replaces <br />
(and <br>
) html tags with newline (\n
) character.
x::array_encode($array)
Turns an array of strings into a single string, separated by a vertical bar (|
) character.
x::array_decode($string)
Turns a string separated by a vertical bar (|
) character into an array of strings.
x::console_log($input, $parameters)
Prints an array, object, or string in a stylized DOM container. Input type is automatically detected, and optional parameters can be used to customize the style of the container.
Typical usage:
With optional parameters:
x::dd($input, $parameters)
Same as console_log()
, but with with a die()
function called afterward. The same parameters are available for styling the container. Yes, it's kinda like Laravel's dd() method.
x::file_write($input, $target_filename, $parameters)
Appends a string, array, or object to a given file. Input type is automatically detected and converted to plain text. Optional parameters can be used to customize fopen() mode and newline behavior.
Using custom parameters:
x::error_log($input, $parameters)
Abstraction for the native PHP error_log() function, appends a timestamp with a given string, array, or object to an error_log
file. Input type is automatically detected and converted to plain text.