承接 slotify/php-sdk 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

slotify/php-sdk

最新稳定版本:v1.0.3

Composer 安装命令:

composer require slotify/php-sdk

包简介

PHP SDK for Slotify API

README 文档

README

The Slotify SDK is a PHP-based API client designed to simplify interactions with the Slotify scheduling app API. It provides a flexible and easy-to-use interface for making HTTP requests, managing configurations, and handling API responses, tailored specifically for Slotify's scheduling features.

Dependencies

This SDK uses the following library for HTTP requests:

  • Guzzle - A PHP HTTP client that makes it easy to send HTTP requests and integrate with web services.

Features

  • Configurable Base URL and API Key: Easily set the base URL and API key.
  • CRUD Operations: Perform Create, Read, Update, and Delete operations on Slotify resources like bookings.
  • Method Chaining: Chain methods for building complex queries with ease.
  • Include Related Data: Fetch related data (e.g., customers, events) with a single request.
  • Built-in Guzzle Integration: Powered by Guzzle for handling HTTP requests.

Installation

Install the library via Composer:

composer require slotify/sdk

Initialization

To use the SDK, initialize it with your API key and the Slotify base URL. Using api key, you can access app level data only. You can not use same key for multiple apps.

use SlotifySDK\ApiService;

$slotifyApi = new ApiService([
    'apiKey' => '8c99a81c-dcbb-4de3-b316-f43b8a902cae',
]);

Usage (endpoints)

Documentation : https://slotify.ca/api

Endpoints/methods:

// App Endpoints
$slotifyApi->getApps();

// Customer Endpoints
$slotifyApi->getCustomers();
$slotifyApi->getCustomer('uuid');
$slotifyApi->createCustomer(['name' => 'John Doe']);
$slotifyApi->deleteCustomer('uuid');
$slotifyApi->updateCustomer('uuid', ['name' => 'Updated Name']);

// Group Endpoints
$slotifyApi->getGroups();
$slotifyApi->getGroup('uuid');
$slotifyApi->createGroup(['name' => 'Group Name']);
$slotifyApi->deleteGroup('uuid');
$slotifyApi->updateGroup('uuid', ['name' => 'Updated Group Name']);

// Resource Endpoints
$slotifyApi->getResources();
$slotifyApi->getResource('uuid');
$slotifyApi->createResource(['name' => 'Resource Name']);
$slotifyApi->deleteResource('uuid');
$slotifyApi->updateResource('uuid', ['name' => 'Updated Resource Name']);

// Scheduler Endpoints
$slotifyApi->getSchedulers();
$slotifyApi->getScheduler('uuid');
$slotifyApi->createScheduler(['title' => 'Scheduler Title']);
$slotifyApi->deleteScheduler('uuid');
$slotifyApi->updateScheduler('uuid', ['title' => 'Updated Scheduler Title']);

// Booking Endpoints
$slotifyApi->getBookings();
$slotifyApi->getBooking('uuid');
$slotifyApi->deleteBooking('uuid');
$slotifyApi->updateBooking('uuid', ['status' => 'confirmed']);
$slotifyApi->createBooking(['customer_id' => 'customer_uuid']);

// Booking Actions
$slotifyApi->completeBooking('uuid');
$slotifyApi->confirmBooking('uuid', [
    'resource_id' => 'resource_uuid',
    'customer_id' => 'customer_uuid'
]);
$slotifyApi->cancelBookingByCustomer('uuid', [
    'customer_id' => 'customer_uuid',
    'cancellation_message' => 'I am unable to attend'
]);
$slotifyApi->cancelBookingByResource('uuid', [
    'resource_id' => 'resource_uuid',
    'cancellation_message' => 'Resource unavailable'
]);
$slotifyApi->declineBooking('uuid', [
    'resource_id' => 'resource_uuid',
    'decline_message' => 'Service not available at this time'
]);
$slotifyApi->bookCustomer([
    'customer' => [
        'seats' => 10,
        'first_name' => 'John',
        'last_name' => 'Doe',
        'email' => 'john.doe@example.com',
        'customer_notes' => 'Please arrive early'
    ]
]);
$slotifyApi->reassignBooking('uuid', [
    'resources' => [
        [
            'old_resource_id' => 'old_resource_uuid',
            'new_resource_id' => 'new_resource_uuid'
        ]
    ]
]);
$slotifyApi->rescheduleBookingByCustomer('uuid', [
    'start' => '2024-11-06T09:00:00-05:00',
    'end' => '2024-11-06T10:00:00-05:00',
    'customer_id' => 'customer_uuid'
]);

// Event Endpoints
$slotifyApi->getEvents();
$slotifyApi->getEvent('uuid');
$slotifyApi->createEvent(['title' => 'Event Title']);
$slotifyApi->deleteEvent('uuid');
$slotifyApi->updateEvent('uuid', ['title' => 'Updated Event Title']);

// Service Endpoints
$slotifyApi->getServices();
$slotifyApi->getService('uuid');
$slotifyApi->createService(['name' => 'Service Name']);
$slotifyApi->deleteService('uuid');
$slotifyApi->updateService('uuid', ['name' => 'Updated Service Name']);

// Workflow Endpoints
$slotifyApi->getWorkflows();
$slotifyApi->getWorkflow('uuid');
$slotifyApi->createWorkflow(['name' => 'Workflow Name']);
$slotifyApi->deleteWorkflow('uuid');
$slotifyApi->updateWorkflow('uuid', ['name' => 'Updated Workflow Name']);

// Availability Endpoints
$slotifyApi->getAvailability(['date' => '2024-01-01']);
$slotifyApi->getUnAvailability(['date' => '2024-01-01']);
$slotifyApi->getAvailabilityCount(['date' => '2024-01-01']);

Usage (Dynamic Includes)

The Slotify SDK supports dynamic includes, allowing you to fetch related data in a single request.

Example:

$slotifyApi->include('customers', 'resources')
           ->getBookings();

Usage (Query Params)

If you want to use query params you can use it as below example. Check doc for more advance usage for search parameters.

Example:

$slotifyApi->queryParams([
    'limit' => 10,
    'search' => 'name~:john',
])->getCustomers();

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-05