Download the PHP package peledies/rhonda without Composer
On this page you can find all versions of the php package peledies/rhonda. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download peledies/rhonda
More information about peledies/rhonda
Files in peledies/rhonda
Package rhonda
Short Description A composer package that provides solutions for common PHP tasks
License MIT
Informations about the package rhonda
Help me \Rhonda
Rhonda is a composer installable package that provides solutions to common PHP tasks.
Install
Require in your project
Add the folowing to your composer.json file
Classes and Methods
\Rhonda\Autoload
Recursivly load all .php files in the provided path, excludes any index.php files.
Method | Description |
---|---|
path(string) | Path to load all php files recursively |
OR
\Rhonda\UUID
Method | Description |
---|---|
create() | Create a new UUID |
OR
\Rhonda\Request
Package all incomming request data into a singleton that can be accessed by your
application. ALL data that goes through packager
is automatically mysql_real_eacaped
even array's and objects recursively.
Method | Description |
---|---|
get('param') | Get the provided query string parameter, mysql escaped |
post() | Get the provided request body, mysql escaped |
In order to use this class you need to first run the packager right after Rhonda is included in your project
\Rhonda\RequestBody
use \Rhonda\Request for a mysql escaped request body
Method | Description |
---|---|
get(boolean) | Get the provided request body, exception can be bypassed by putting TRUE as an argument |
OR
OR Bypass exception
\Rhonda\Response
Method | Description |
---|---|
package(object/array/string) | Package the data in an object with possible errors |
OR
\Rhonda\Success
Method | Description |
---|---|
create() | create a uniform success message |
OR
\Rhonda\Error
Method | Description |
---|---|
handle() | Fromat an exception for return. Also writes a pretty stack trace to the error log |
deprecation_warning(message, alternate route) | Adds a Warning header and changes the status code to 299 |
add_summary_item(Object) | Adds any object to the error summary singleton |
summary() | Retrieves the error summary data Array |
OR
\Rhonda\Config
Method | Description |
---|---|
load_file() | Load a JSON file into memory as an object for later retrieval |
load_object() | Load an object into memory for later retrieval |
get() | Retrieve a configuration object from memory |
Load Object to memory
Load JSON file to memory
Retrieve a configuration object from memory
\Rhonda\APIGateway
Method | Description |
---|---|
run( optional ) | Run a request to an external URL. optional boolean parameter for exception bypass |
Make a request to an external address with custom headers and a request body
\Rhonda\Strings
Method | Description |
---|---|
validate( type_string, test_string ) | Return True/False |
validate_or_error( type_string, test_string ) | Return True/False or throws exception |
normalize( string ) | Returns normalized string |
String Normalization
- Removes non word characters
- Converts the string to lowercse
- Converts spaces and dashes to underscores
- Trims trailing invalid characters
Validation Types
Type | Description |
---|---|
'email' | Verifies proper email structure |
'username' | Tests that string only includes a-z 0-9 . - or _ |
Test that a string is a valid email (without exception)
Test that a string is a valid email (with exception)
Normalize a string
\Rhonda\Headers
Method | Description |
---|---|
getallheaders() | Return an Array of all request headers, works for Apache, PHP, and Nginx servers |
set_response_code(integer) | Set the response code and text to a specific value (accepts: 200, 209, 400, 404) |
Retrieve All request headers as an Array
OR
\Rhonda\Mysql
Method | Description |
---|---|
real_escape(String, Array, Object) | Escape the thing being passed in by utilizing mysqli and real_escape_string. These methods require a mysql connection so you will need to load a config file into the variable DB. real_escape uses utf-8 as the charset. When escaping an Array or Object, recursion is used and it will drill through the object/array and escape everything. |
bool_to_string(STRING) | Convert ANY truthy or falsy thing into a '1' or a '0' for mysql query building |
Escape a String
Escape an Object
Escape an Array
Convert to Mysql boolean
\Rhonda\ServiceChain
Method | Description |
---|---|
register(optional ) |
Register this application or micro service to the service chain. |
report(Boolean ) |
Return a string (default) or an Array of the service chain if parameter is set to TRUE |
If you are using ServiceChain, register()
should be one of the first things you do in your application,
preferably immediately after the composer autoload.
The default behavior of register is to use your config object named system
for a property named host
.
\Rhonda\ServiceChain:: register()
will automatically use that value for the service name.
(Prefered) Register this micro service to the service chain using a config file
Register this micro service to the service chain using a parameter
Get the current service chain state
\Rhonda\CORS
Method | Description |
---|---|
allow_headers() | Set headers to allow CORS request |
OR
\Rhonda\Boolean
Method | Description |
---|---|
evaluate(STRING) | Read a string to change to a boolean TRUE/FALSE |
OR
\Rhonda\Google
Method | Description |
---|---|
geo_code(STRING, ARRAY) | Load and address with Google api key and Array of address parameters |
OR
Method | Description |
---|---|
prepare_query_string(ARRAY) | Prepare a Google Array of address parameters |
OR