2017 © Pedro Peláez
 

library realtsoft-client-api

PHP class for Realtsoft API

image

taral14/realtsoft-client-api

PHP class for Realtsoft API

  • Friday, April 20, 2018
  • by taral14
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Realtsoft API - User class

An official PHP class for work with Realtsoft API., (*1)

Requirements:

  • PHP >= 5.3.0

Installation

Via Сomposer

composer require "taral14/realtsoft-client-api @dev"

Code example

<?php
use RealtsoftApi\Client;
$api = new Client('https://your-project.realtsoft.net', KEY, SECRET);
// find contacts
$rows = $api->call('client/index', [
    'phone' => PHONE_NUMBER,
    'email' => CLIENT_EMAIL,
]);
// if contact not found
if(empty($rows)) {
    // create new client
    $response = $api->call('client/create', [
        'phones' => [CLIENT_PHONE_1, CLIENT_PHONE_2],
        'name' => SET_CLIENT_NAME,
        'email' => SET_CLIENT_EMAIL,
        'responsible_user_id' => 1, // responsible user
    ], 'POST');
    if(!$response->success) {
        echo 'Failed to create contact';
        echo print_r($response->errors);
        exit;
    }
    $client = $response->model;
} else {
    $client = $rows[0];
}
// create new inquiry
$response = $api->call('inquiry/create', [
    'responsible_user_id' => 1,
    'deal' => INQUIRY_DEAL,
    'realty_type' => INQUIRY_REALTY_TYPE,
    'category' => INQUIRY_CATEGORY,
    'name' => INQUIRY_NAME,
    'price_kind' => 'per_object',
    'client_id' => $client->id,
    'source_kind' => INQUIRY_SOURCE_KIND,
], 'POST');

if($response->success) {
    echo 'SUCCESS';
    echo print_r($response->model);
} else {
    echo 'ERROR';
    echo print_r($response->errors);
}

The Versions

20/04 2018

dev-master

9999999-dev https://github.com/taral14/realtsoft-client-api

PHP class for Realtsoft API

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Avatar taral14

api realtsoft

20/04 2018

1.0.1

1.0.1.0 https://github.com/taral14/realtsoft-client-api

PHP class for Realtsoft API

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Avatar taral14

api realtsoft