PHP code example of peledies / rhonda

1. Go to this page and download the library: Download peledies/rhonda library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

peledies / rhonda example snippets


  "  "peledies/rhonda": "~1"
  }

  \Rhonda\Autoload::path(__DIR__."/path/to/load/");

  $load = new \Rhonda\Autoload();
  $load->path(__DIR__."/path/to/load/");

  \Rhonda\UUID::create();

  $uuid = new \Rhonda\UUID();
  $uuid->create();

  \Rhonda\Request::packager();

  # GET parameters
  $thing = \Rhonda\Request::get();

  # GET specific query string value
  $thing = \Rhonda\Request::get('string');

  # POST body
  $thing = \Rhonda\Request::post();

  \Rhonda\RequestBody::get();

  $request_body = new \Rhonda\RequestBody();
  $request_body->get();

  $request_body = new \Rhonda\RequestBody();
  $request_body->get(TRUE);

  \Rhonda\Response::package($data);

  $response_package = new \Rhonda\Response($data);
  $response_package->package();

  echo \Rhonda\Success:: create();

  $msg = new \Rhonda\Success();
  echo $msg->create();

  try{
    throw new Exception("Demo Error Exception");
  }catch(\Exception $e){
    echo \Rhonda\Error::handle($e);
  }

  try{
    throw new Exception("Demo Error Exception");
  }catch(\Exception $e){
    $error = new \Rhonda\Error();
    echo $error->handle($e);
  }

  $object = new stdClass();
  $object->thing_1 = 'something one';
  $object->thing_2 = 'something two';
  \Rhonda\Config::load_object('test_one', $object);

  // File path is relative to your project root
  $config->load_file('test_two', 'path/to/file.json');

\Rhonda\Config::get('test_one');

try{
  $headers = array("Domain"=>"domain_1", "Authorization"=>"sometoken");
  $data = (object) array("handle"=>"demo_1", "password"=>"asdf");
  $api = new \Rhonda\APIGateway('POST','http://elguapo.eventlink.local/authenticateasdf/',$data, $headers);
  $data = $api->run();
}catch(\Exception $e){
  $error = new \Rhonda\Error();
  echo $error->handle($e);
}

try{
  // PASS
  $string = '[email protected]';
  \Rhonda\Strings:: validate('email',$string);

  // FAIL
  $string = 'test@test';
  \Rhonda\Strings:: validate('email',$string);

  // Catch will not be invoked
}catch(\Exception $e){
  echo \Rhonda\Error:: handle($e);
}

try{
  // PASS
  $string = '[email protected]';
  \Rhonda\Strings:: validate_or_error('email',$string);

  // FAIL
  $string = 'test@test';
  \Rhonda\Strings:: validate_or_error('email',$string);

  // Catch will be invoked
}catch(\Exception $e){
  echo \Rhonda\Error:: handle($e);
}

  $input = 'Some TEST-@#string-#$-!@';
  \Rhonda\Strings:: normalize($input);

  // Returns
  some_test_string

  $headers = \Rhonda\Headers:: getallheaders();

  $headers = new \Rhonda\Headers();
  $headers->getallheaders();

$string = "that's all folks";
$string = \Rhonda\Mysql::real_escape($string);

$object = new \stdClass();
$object->thing = "it's for real";
$object = \Rhonda\Mysql::real_escape($object);

$array = array(
   "ray"=>"it's escaping arrays"
 , "ray2"=>"escape's this one too"
);
$array = \Rhonda\Mysql::real_escape($ray);

  $value = \Rhonda\Mysql:: bool_to_string('true');
  OR
  $mysql = new \Rhonda\Mysql();
  $value = $mysql->bool_to_string('true');

    // Load your configuration file to memory
  \Rhonda\Config:: load_file('system', 'path/to/file.json');

  // Register your service name
  \Rhonda\ServiceChain:: register();

    // Register your service name
  \Rhonda\ServiceChain:: register('Service-Name');

  // "Returns: service1 => service2 => etc"
  \Rhonda\ServiceChain:: report();

  // "Returns: array("service1", "service2", "etc")
  \Rhonda\ServiceChain:: report(TRUE);

  \Rhonda\CORS::allow_headers();

  $cors = new \Rhonda\CORS();
  $cors->allow_headers();

  \Rhonda\Boolean::evaluate('yes');

  $boolean = new \Rhonda\Boolean();
  $boolean->evaluate('false');

  \Rhonda\Google::geo_code('google_api_key', array('1600 Amphitheatre Parkway', 'Mountain View', 'CA 94043', 'USA'));

  $googleApi = new \Rhonda\Google();
  $googleApi->geo_code('google_api_key', 'array_of_address_parameters');

  \Rhonda\Google::prepare_query_string(array('1600 Amphitheatre Parkway', 'Mountain View', 'CA 94043', 'USA'));

  $googleApi = new \Rhonda\Google();
  $googleApi->prepare_query_string(array('1600 Amphitheatre Parkway', 'Mountain View', 'CA 94043', 'USA'));