PHP code example of code16 / machina-client

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

    

code16 / machina-client example snippets



    $client = new \Code16\MachinaClient\MachinaClient;

    $client->setBaseUrl("https://example.com/api");
    $client->setCredentials([
        "client" => "some-client-key",
        "secret" => "some-secret-key",
    ]);

    try {
        $client->get("/foo");  // ['foo => bar'];
    }
    catch(\Code16\MachinaClient\Exceptions\InvalidCredentialsException $e) 
    {
        // Incorrect credentials
    }