piggy / piggy-php-sdk
php sdk piggy
3.7.4
2024-09-16 14:11 UTC
Requires
- php: >=7.2
- ext-json: *
- guzzlehttp/guzzle: ~5.3 || ~6.0 || ^7.0
- marc-mabe/php-enum: ^4.7
Requires (Dev)
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^5.7 || ^6.5 || ^7.1 || ^8.5
- dev-master
- v4.x-dev
- 3.7.4
- 3.7.3
- 3.7.2
- 3.7.1
- 3.7.0
- 3.6.0
- 3.5.0
- 3.4.0
- 3.3.4
- 3.3.3
- 3.3.2
- 3.3.1
- 3.3.0
- 3.2.0
- 3.1.0
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- v3.0.0-beta2
- v3.0.0-beta1
- 2.0.x-dev
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
- 0.0.11
- 0.0.1
- dev-Fix_bug_on_static_mappers
- dev-fix_bug_on_transaction_list_when_reward_is_null
- dev-develop
- dev-perks
- dev-unlink_and_delete_contact_identifier
- dev-upgrade_to_8.2
- dev-native_enums
- dev-add_attributes_to_promotion_and_vouchers
- dev-generic-mapper
- dev-work_on_static
- dev-sdk_update
- dev-giftcard
This package is auto-updated.
Last update: 2024-09-16 14:14:31 UTC
README
通过 Piggy 的全能平台,您可以加强客户忠诚度并自动化每一步。从奖励计划到品牌礼品卡和智能电子邮件营销——Piggy 一站式服务。
您可以使用此软件包将您的应用程序/POS系统(收银机)连接到Piggy账户。请确保选择适合您需求的正确API客户端。
有关我们API的完整文档可以在此处找到 https://docs.piggy.eu/
版本
您应使用此SDK的v3版本。然而,此版本与SDK的v1.*版本不兼容。
需求
此SDK需要PHP 7.2或更高版本。目前我们的测试套件在PHP 7.2、7.3、7.4、8.0、8.1上运行。
设置
Composer
composer require piggy/piggy-php-sdk
快速入门
使用Register客户端的示例
$apiKey = 'xxxx-xxxx-xxxx';
$client = new Piggy\Api\RegisterClient($apiKey);
try {
$contact = $client->contacts->findOneBy('test@domain.com'); // Example call to find a Contact by e-mail address
} catch(Piggy\Api\Exceptions\MaintenanceModeException $e) {
// Catch maintenance mode specific.
} catch(Piggy\Api\Exceptions\PiggyRequestException $e) {
// If no Contact is found, you'd know that from this exception
} catch(\Exception $e) {
// Handle any other exceptions
}
使用API密钥的静态函数示例
$apiKey = 'xxxxxxxx';
$baseUrl = "https://api.piggy.eu";
ApiClient::configure($apiKey, $baseUrl);
try {
// Example call to update a Contact by UUID
Contact::update("1234ab-7890-asdf-1234-a1b2c3d4", ["attributes" => ["firstname" => "henk", "housenumber" => 10]]);
} catch(Piggy\Api\Exceptions\MaintenanceModeException $e) {
// Catch maintenance mode specific.
} catch(GuzzleHttp\Exception\GuzzleException $e) {
// If no Contact is found, you'd know that from this exception
} catch(\Exception $e) {
// Handle any other exceptions
}