Skip to content

codwelt/wasi-sdk-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wasi SDK PHP

You can sign up for a Wasi account at https://wasi.co and get your id_company and wasi_token

Requirements

PHP 7.1.* and later.

Installation

Composer

You can install the bindings via Composer. Run the following command:

composer require wasico/sdk-php

To use the bindings, use Composer's autoload:

require_once('vendor/autoload.php');

Or add manually to your composer.json file for constant update

"wasico/sdk-php": ">=0.0.1"

First configuration

Set your configuration only one time in execution time

\Wasi\SDK\Configuration::set([
    'v'          => 1, //API version here
    'id_company' => 123456, //Your id_company here
    'wasi_token' => 'AbCd_eFgH_IjKl_MnOp', //Your WasiToken here
]);

Usage

Use Wasi models (\Wasi\SDK\Models) for get Objects of the API

Find one element

#Replace 123456 with the id_property
$property = \Wasi\SDK\Models\Property::find(123456);

Filter and get elements

#Use API filters in the 'where' method
$properties = \Wasi\SDK\Models\Property::where('title', 'Hotel')->get();

Create an element

$customer = new \Wasi\SDK\Models\Customer();
$customer->id_user = 123;
$customer->id_country = 1;
$customer->id_region = 26;
$customer->id_city = 63;
$customer->first_name = "Jose W";
$customer->save()
#Now you can get id_client:
$id_client = $customer->id_client;

Update an element

$customer = \Wasi\SDK\Models\Customer::find(4321);
$customer->last_name = 'Capera';
$customer->save()

Packages

No packages published

Languages

  • PHP 100.0%