PHP code example of laraman / beyonic

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

    

laraman / beyonic example snippets


composer 

Laraman\Beyonic\BeyonicServiceProvider::class,

'LaramanBeyonic' => Laraman\Beyonic\Facades\BeyonicFacade::class,

php artisan vendor:publish  --provider="Laraman\Beyonic\BeyonicServiceProvider"

use LaramanBeyonic;



...

use LaramanBeyonic;

...

class PaymentController {
  
    public function createCollection(Request $request) {
        
        $requestData = [
            "phonenumber" => "+80000000001",
            "amount" => "100.2",
            "currency" => "BXC",
            "metadata" => ["my_id"=>"123ASDAsd123"],
            "send_instructions" => True,
            "subscription_settings" => [
                 "start_date"=>"24/05/2019 10:30:00",
                 "end_date"=>"24/06/2019 10:30:00",
                 "frequency"=>"weekly"
            ]
        ];
        
        try {
          $response = LaramanBeyonic::createCollection( $requestData );
          ...
        } catch (\Exception $ex) {
          $error = json_decode($ex->getMessage());
          ...
        }
    }
}