piggy / piggy-php-sdk
php sdk piggy
Installs: 18 596
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 5
Open Issues: 3
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.12.0
- 3.11.3
- 3.11.2
- 3.11.1
- 3.11.0
- 3.10.0
- 3.9.1
- 3.9.0
- 3.8.0
- 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-v4-testing-setup
- dev-feature/add-missing-properties-to-promotion
- dev-39-uncaught-typeerror-get_object_vars
- 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: 2025-04-29 01:12:00 UTC
README
With Piggy's all-in-one platform you can strengthen loyalty and automate every step. From reward programs, to branded giftcards and smart email marketing - Piggy takes care of it all.
You can use this package to connect your application / POS-system (Register) to a Piggy account. Please make sure to choose the right API Client for your needs.
Full documentation about our API can be found here https://docs.piggy.eu/
Versions
You should use v3 of this SDK. However this is not backward compatible with v1.* of this SDK.
Requirements
This SDK requires PHP 7.2 or higher. Currently our test suite runs against PHP 7.2, 7.3, 7.4, 8.0, 8.1
Setup
Composer:
composer require piggy/piggy-php-sdk
Quickstart
Example with Register Client
$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
}
Example with Static Functions using API Key
$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
}