PHP code example of usulix / laravel-netsuite

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

    

usulix / laravel-netsuite example snippets


     composer 

    $myRESTletService = app('NetSuiteApiService');

    /**
    * You can set processing on the response Body returned
    * 'raw' - just return the stream retrieved (default)
    * 'singleDecode' - return json_decode($body, true)
    * 'doubleDecode' - return json_decode(json_decode($body,  true), true)
    * 'responseData' - return json_decode(json_decode($body,  true), true)['data']
    *
    * Your mileage may vary based upon how your NetSuite RESTlet is coded
    */

    $myRESTletService->setReturnProcessing('singleDecode');

    /**
    * You can set the Request Method (default is 'POST')
    */

    $myRESTletService->setMethod('POST');

    /**
    * retrieve your response by calling getNetsuiteData with your RESTlet Id and
    * any payload in an array
    */

    $myResults = $myRESTletService->getNetsuiteData('123',
       ['action' => 'myAction', 'user'=>'212121']
    );

    foreach($myResults as $res){
                $this->doSomething($res);
    }