tigerheck / laravel-vcita
Laravel wrapper for vCita APIs
Installs: 52
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/tigerheck/laravel-vcita
Requires
- php: ^8.0.2
 
README
A Laravel wrapper for vCita API.
Install
Via Composer
$ composer require tigerheck/laravel-vcita
Configuration
Laravel vCita requires connection configuration. To get started, you'll need to publish all vendor assets:
$ php artisan vendor:publish --provider="TigerHeck\Vcita\VcitaServiceProvider"
Add VCITA_BASE_URL= and VCITA_API_KEY= to your enviroment configuraiton file
Usage
See documention for params and others at vCita docs
Examples with \Http::vcita()
Get clients
$response = \Http::vcita()->get("/platform/v1/clients", [
    'search_term' => $email,
    'search_by' => 'email',
]);
Create a Client
$response = \Http::vcita()->post("/platform/v1/clients", [
    'address'           => $address,
    'custom_field1'     => $custom_field1,
    'custom_field2'     => $custom_field2,
    'custom_field3'     => $custom_field3,
    'email'             => $email,
    'first_name'        => $first_name,
    'last_name'         => $last_name,
    'phone'             => $phone,
    'source_campaign'   => $source_campaign,
    'source_channel'    => $source_channel,
    'source_name'       => $source_name,
    'source_url'        => $source_url,
    'staff_id'          => $staff_id,
    'status'            => $status,
    'tags'              => $tags,
]);
Updates a Client
$response = \Http::vcita()->put("/platform/v1/clients/{$client_id}", [
    'address'           => $address,
    'custom_field1'     => $custom_field1,
    'custom_field2'     => $custom_field2,
    'custom_field3'     => $custom_field3,
    'email'             => $email,
    'first_name'        => $first_name,
    'last_name'         => $last_name,
    'phone'             => $phone,
    'source_campaign'   => $source_campaign,
    'source_channel'    => $source_channel,
    'source_name'       => $source_name,
    'source_url'        => $source_url,
    'staff_id'          => $staff_id,
    'status'            => $status,
    'tags'              => $tags,
]);
Deletes a Client by Id
$response = \Http::vcita()->delete("/platform/v1/clients/{$client_id}");
Retrieves a Client by Id
$response = \Http::vcita()->get("/platform/v1/clients/{$client_id}");
Examples with app("vcita")
Support client api with this method, provide support for rest of api later on.
Get clients
$response = app("vcita")->allClients([
    'search_term' => $email,
    'search_by' => 'email',
]);
Get clients (response with specific access point)
$response = app("vcita")->allClients([
    'search_term' => $email,
    'search_by' => 'email',
], 'data.clients');
Create a Client
$response = app("vcita")->createClient([
    'address'           => $address,
    'custom_field1'     => $custom_field1,
    'custom_field2'     => $custom_field2,
    'custom_field3'     => $custom_field3,
    'email'             => $email,
    'first_name'        => $first_name,
    'last_name'         => $last_name,
    'phone'             => $phone,
    'source_campaign'   => $source_campaign,
    'source_channel'    => $source_channel,
    'source_name'       => $source_name,
    'source_url'        => $source_url,
    'staff_id'          => $staff_id,
    'status'            => $status,
    'tags'              => $tags,
]);
Updates a Client
$response = app("vcita")->updateClient($client_id, [
    'address'           => $address,
    'custom_field1'     => $custom_field1,
    'custom_field2'     => $custom_field2,
    'custom_field3'     => $custom_field3,
    'email'             => $email,
    'first_name'        => $first_name,
    'last_name'         => $last_name,
    'phone'             => $phone,
    'source_campaign'   => $source_campaign,
    'source_channel'    => $source_channel,
    'source_name'       => $source_name,
    'source_url'        => $source_url,
    'staff_id'          => $staff_id,
    'status'            => $status,
    'tags'              => $tags,
]);
Deletes a Client by Id
$response = app("vcita")->deleteClient($client_id);
Retrieves a Client by Id
$response = app("vcita")->getClient($client_id);