PHP code example of guardian360 / resonance

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

    

guardian360 / resonance example snippets


// First, we set up a library client which we want our client to use. Here, we
// are using a Guzzle client, which we can predefine beforehand with options
// such as headers, cookies or multipart requests.
$library = new GuzzleHttp\Client(['base_uri' => 'https://localhost']);

// Next we feed the library to the driver we'd like to use. In this case, since
// we've setup a Guzzle client, we'll be using the Guzzle driver naturally.
$driver = new Resonance\Drivers\Guzzle($library);

// Finally we feed the driver we want to use to our client.
$client = new Resonance\Client($driver);

// Then we can simply perform HTTP requests and get the response body.
// For example, GET requests...
$response = $client->get('/');

// POST requests...
$response = $client->post('/contact', [
    'email' => '[email protected]',
    'subject' => 'Hi there',
    'content' => 'Resonance is so cool, it makes everything so simple!'
]);

// PUT requests...
$response = $client->put('/users/1/edit', ['name' => 'Mambo Jambo']);

// And DELETE requests.
$response = $client->delete('/posts/1');