PHP code example of austinbillings / rad

1. Go to this page and download the library: Download austinbillings/rad 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/ */

    

austinbillings / rad example snippets


$router = Rad\Router($currentURI);
$entity = Rad\Base;

$router->get('/users', function ($params, $query) {
	$entity->deliver($userClass->getList());
});

$router->get('/users/:userID', function ($params, $query) {
	$entity->deliver($userClass->getUser($params["userID"]));
});

use Rad\Tools as Tools;

class MyClass {
	public function example () {
		echo Tools::firstName('Austin Billings');
		# Returns "Austin"
	}
}

 
# MySendScript.php

ent of our email message
# As long as the first character of the HTML is '<',
# a plaintext version is automatically generated and sent as well.
#
# It can be specified separately by the #setMessage() function,
# or by using an associative array here, like this:
#
# $blast = ["text" => $myTextMessage, "html" => $myHtmlVersion];
#
$blast = file_get_contents(__DIR__ . '/blast.html');
echo "Blast size is ".strlen($blast)." chars\n\n";

# Let's use dat Courier.
$sender = new Rad\Courier([
  "system" => "SendGrid", # case insensitive, accepts sendgrid, mandrill, ses, defaults to PHP
  "sendGridKey"=> "SG.abcdefghijklm_abcdefgh.1-gabby0123456789abcdefghijklmnopqrstuvwxyz",
  
  "to" => $someListOfEmails, # You can use a string OR an array here
  "from" => "[email protected]", # Address of the SENDER
  "name" => "GroundUP Music Festival", # Name of the SENDER
  
  "subject" => "GroundUp Music Festival lands on Miami Beach next week!",
]);

$sender->setMessage($blast);

# ->send() synchronously returns a boolean: true if all sent, false if any failure.
echo ($sender->send() ? 'Sent successfully!' : 'Send failed.')."\n";

# ----------------------------------------------------------------------
#                       yeah, it's that easy!
# ----------------------------------------------------------------------

bash
composer Script.php
bash
php MySendScript.php
> Blast size is 3175 chars
>
> Sent successfully!