PHP code example of mblsolutions / simfoni-php-laravel

1. Go to this page and download the library: Download mblsolutions/simfoni-php-laravel 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/ */

    

mblsolutions / simfoni-php-laravel example snippets


\MBLSolutions\SimfoniLaravel\SimfoniServiceProvider::class,

$simfoniAuth = new \MBLSolutions\Simfoni\Authentication();

$authentication = $simfoniAuth->password(1, 'auth-secret', '[email protected]', 'password');

[
    'token_type' => 'Bearer',
    'expires_in' => 31622400,
    'access_token' => 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjBmOGMwNDAxZDAy',
    'refresh_token' => 'def5020002eca9ac7875d5d800c195024d7fb702535c0d30a0',
    'user' => [
        'name' => 'John Doe',
        'email' => '[email protected]',
        'role' => 'programme_manager'
    ]
];

\MBLSolutions\Simfoni\Simfoni::setToken('eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjBmOGMwNDAxZDAy');


$payload = [
    'urn' => 1234,
    'items' => [
        'data' => [
            [
                'sku' => 'ECODE_SKU',
                'quantity' => 1,
                'price' => 10.00,
                'activation_date' => '2021-01-01T17:00:00+00:00',
            ],
        ]
    ]
];

\MBLSolutions\Simfoni\Simfoni::setToken('your-token');

$order = new \MBLSolutions\Simfoni\Order();
$response = $order->create($payload);

[
    'data' => [
        'id' => 6000001,
        'invoice_number' => null,
        'client_name' => 'An Client',
        'account_name' => 'An Account',
        'reference' => 'order-reference-here',
        'po_number' => null,
        'discount' => 0,
        'handling' => 0,
        'status' => 'Awaiting Payment',
        'contact_company' => 'An Account',
        'contact_title' => 'Ms',
        'contact_first_name' => 'Dayton',
        'contact_last_name' => 'Quitzon',
        'contact_email' => '[email protected]',
        'contact_address1' => '843',
        'contact_address2' => 'Freeway',
        'contact_address3' => 'Apt. 979',
        'contact_town_city' => 'Lake Faye',
        'contact_county' => 'Idaho',
        'contact_postcode' => '43270',
        'contact_country' => 'GB',
        'billing_company' => 'An Account',
        'billing_title' => 'Ms',
        'billing_first_name' => 'Dayton',
        'billing_last_name' => 'Quitzon',
        'billing_email' => '[email protected]',
        'billing_address1' => '843',
        'billing_address2' => 'Freeway',
        'billing_address3' => 'Apt. 979',
        'billing_town_city' => 'Lake Faye',
        'billing_county' => 'Idaho',
        'billing_postcode' => '43270',
        'billing_country' => 'GB',
        'order_date' => '2021-01-01T15:00:00+00:00'
    ],
];

\MBLSolutions\Simfoni\Simfoni::setToken('your-token');

$issuedInfo = new \MBLSolutions\Simfoni\IssuedInfo();
$result = $issedInfo->show('your-hash');

[
    'data' => [
        [
            'item_id' => 'XqVroNPWnw',
            'sku' => '12345678',
            'value' => 100,
            'masked_pan' => '************1350',
            'encrypted_pan' => 'eyJpdiI6ImJuY2RIM3hrSnVcL3Q4amhET1BwSjZnPT0iLCJ2YWx1ZSI6ImRwWU42anNZNlFXZUJ0REVFSXJDTFFmNjVuZHFcL3ZNaXQ1Z3gzNUZ1OUt3PSIsIm1hYyI6IjVkMjM5ODlkYWM2ZjE5OWJiYjMzNWQyYTZkZDI1ZWJkZGUzMTVlZDFjOGM5NDM4YzllNWM5ZWExN2YxNDZhMjYifQ==',
            'masked_serial' => '****4360',
            'encrypted_serial' => 'eyJpdiI6IlwvVXpuQW9KVittem1rQnVQc0t3N2p3PT0iLCJ2YWx1ZSI6IlFKSGt6OXpHWWlnSFJ5WjFGWDAxaVE9PSIsIm1hYyI6ImRlNTEwMzUzZTZlZjUyNjdkZDBhZTFlYWFiOWNiYzIyNmZlNWJhMGFiYjgxYzI1NzgzMTIzMjFiYjYwOWYyMDQifQ==',
            'pin' => 'eyJpdiI6IndXNldUdkRDeDZkVFFiSVErK25sM1E9PSIsInZhbHVlIjoidjJBUFVhUlMzaTFMREVTSEVTYTRQRTkydnlaN2tESmR4ZXVpd1hpMVZaWGdseVwvNnNFeEVZVyttZEMyRnZ1dVhXWElNM3p6dWhGYmNjTko0ZE12N3dYemFxTllMVU5SVU9EdHhaZGFad2xlUXFKXC9HWEpyTFVnUVNcL2wwQTAwT2RMWEdxUVM4ZklvdnJtNlNzY3ZYaHBuS0dzZkt5QlRoSWZHc2kyb0ppSkRiR0ttMVYrbXg3ZmYrRXBjS1ZkQVhacjV4clhjaVg1TlNxVkFmV2FZb3dKRTdIajVZRDQ1ck9vVFwvTkFZZXpOa1VSSW5pTE9lTVdXelVVTU5OR2h1MWNUK2JFMjZZT1lZQmZ1OEkrS1VINzNnPT0iLCJtYWMiOiJkNTNiOWE1NzFlZDI2MGM1Y2M1MjU3NTcxYzNmMjgxZmRlMjdmMDYwYzRmZDIyYzA2YmQzN2RkZTBkZGMxY2RmIn0=',
            'url' => 'eyJpdiI6Imk0YndiZUZQUGxmN25JMWZQT21KVkE9PSIsInZhbHVlIjoiZW02eTFCem9wRmZsV3pxNUZsZkFqZWFHYWwyOEFhajNCXC9nSVFcL0lEUk9rWnIrbTM5NjBkK0lMV0paSlVzcVRUcG0xVXk0d0ZjYk9wWjlTTlUrQlRIa3QxbHhscWlJdDJ3VlhFUkladjl5eEo4Rnk2UlwvdmNcL21ZTmMzR3ZOc3RuNVYwU0YyUmVtdVA2T0YybDhWSHlydGx6TTZLY2hUUGdxOEhmTWw3NDZoMlJnQ01GRUFSZFdUVE41UEZOditzdWxrQ3NqaGlFOEZWS0d3ZjR0VGUrdTVXcHdHT1E4dzRjQ08xUVJUdWVoSUlNamhcL3ZOTUEwY29henh0S25ZU0MrTWcrNEFBWko1MjdFR1U1RHpvcUN2K01LSzArVjZNZmR0S29EQkM4NG4zNFIxbGhXNG1Ma25OeHZLSmk3aWtcL0siLCJtYWMiOiJiMmY1M2JhNTYyNmFhNzJhNmJmNGNkOWRkMDhlODY0ZDY2MjYzNjJjN2ZkODViM2E0MzRmNWUyYTY2MjQ2MzRiIn0=',
            'activation_date' => '2018-12-25T00:00:00+00:00'
        ]
    ],
    'links' => [
        'first' => 'https://simfoni.co.uk/api/order/eyJpdiI6Im9FN1pMZ2kwMlRlcXU1c1Z5cGxxNXc9PSIsInZhbHVlIjoiXC9SXC9xOFFSSklWa3lEWG82bDhsN293PT0iLCJtYWMiOiIxMDBmYmVjODlhYjE3MDcxNzc2ZDM2NmMxY2YwNThlNWFjN2E3ZDQ3MjBkMTE5NGQwYzE4MDZlNmI3YjkwZjdmIn0=/issuedinfo?page=1',
        'last' => 'https://simfoni.co.uk/api/order/eyJpdiI6Im9FN1pMZ2kwMlRlcXU1c1Z5cGxxNXc9PSIsInZhbHVlIjoiXC9SXC9xOFFSSklWa3lEWG82bDhsN293PT0iLCJtYWMiOiIxMDBmYmVjODlhYjE3MDcxNzc2ZDM2NmMxY2YwNThlNWFjN2E3ZDQ3MjBkMTE5NGQwYzE4MDZlNmI3YjkwZjdmIn0=/issuedinfo?page=1',
        'prev' => null,
        'next' => null
    ],
    'meta' => [
        'current_page' => 1,
        'from' => 1,
        'last_page' => 1,
        'path' => 'https://simfoni.co.uk/api/order/eyJpdiI6Im9FN1pMZ2kwMlRlcXU1c1Z5cGxxNXc9PSIsInZhbHVlIjoiXC9SXC9xOFFSSklWa3lEWG82bDhsN293PT0iLCJtYWMiOiIxMDBmYmVjODlhYjE3MDcxNzc2ZDM2NmMxY2YwNThlNWFjN2E3ZDQ3MjBkMTE5NGQwYzE4MDZlNmI3YjkwZjdmIn0=/issuedinfo',
        'per_page' => 20,
        'to' => 1,
        'total' => 1
    ],
];


// test decrypting a 4 digit pin
$decrypt = new new \MBLSolutions\Simfoni\Decrypt('JD62JFgGrKJdc1UsZmHykg==');
$string = 'eyJpdiI6Ikhjdlp1Uzc0WFZ2MkdDZ3lHc3VVQnc9PSIsInZhbHVlIjoiXC8reHhBditLWUc3eDdiWlFhVm96enBXQlhJSUR6VzZZb3I4NE9MNkd6Tms9IiwibWFjIjoiYjFiNWRlYzI0NDY2ZmZmYTk4NGJhMjgxN2EwZTAyZjg0YzJmNjg5YmNiMDA2ZDQ1OWViODgxM2QwM2FiNjk3YSJ9';

$pin = $decrypt->data($string);
// pin = 3840

[
    'data' => [
        // results
    ],
    'links' => [
        'first' => 'https://simfoni.co.uk/api/order?page=1',
        'next' => 'https://simfoni.co.uk/api/order?page=2',
    ],
    'meta' => [
        'current_page' => 1,
        'from' => 1,
        'last_page' => 1,
        'path' => 'https://simfoni.co.uk/api/order',
        'per_page' => 20,
        'to' => 1,
        'total' => 1
    ]
];

[
    'message' => 'A message describing the error',
];

[
    'message' => 'The given data was invalid.',
    'errors' =>  [
        // errors here
    ],
];
bash
composer 
bash
php artisan vendor:publish --prodivder="MBLSolutions\SimfoniLaravel\SimfoniServiceProvider"