PHP code example of jbtje / vtiger-laravel

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

    

jbtje / vtiger-laravel example snippets


use JBtje\VtigerLaravel\Vtiger;

$vtiger = new Vtiger();
$data = $vtiger->listTypes();

$vtiger = new Vtiger();
$data = $vtiger->describe( 'Contacts' );

$vtiger = new Vtiger();
$data = [
    'assigned_user_id' => '4x1',
    ...
];
$data = $vtiger->create( $MODULE_NAME, json_encode( $data ) );

$vtiger = new Vtiger();
$data = $vtiger->retrieve( '4x1' );

$vtiger = new Vtiger();
$obj = $vtiger->retrieve( '4x1' );

$obj->result->field_name = 'Your new value';
$data = $vtiger->update( $obj->result );

$vtiger = new Vtiger();
$data = $vtiger->delete( '4x1' );

$dataType = 'phone';
$phoneNumber = '1234567890';
$module = 'Leads';
$columns = ['phone', 'fax']; // Must be an array
    
$vtiger = new Vtiger();
$data = $vtiger->lookup( $dataType, $phoneNumber, $module, $columns );

$vtiger = new Vtiger();
$query = DB::table( 'Leads' )->select( 'id', 'firstname', 'lastname' )->where( 'firstname', 'John' );
$data = $vtiger->search( $query );

foreach( $data->result as $result ) {
    // Do something
}

$vtiger = new Vtiger();
$data = $vtiger->search( $query, false );

$query = "SELECT * FROM ModuleName;";

$vtiger = new Vtiger();
$data = $vtiger->query($query);

foreach( $data->result as $result ) {
    // Do something
}

    VTIGER_URL=https://your-crm-domain.com/webservice.php
    VTIGER_USERNAME=
    VTIGER_KEY=
    VTIGER_PERSISTENT=true
    VTIGER_RETRIES=10
    

    php artisan vendor:publish --tag="vtiger"