PHP code example of spackleso / spackle-php
1. Go to this page and download the library: Download spackleso/spackle-php library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
spackleso / spackle-php example snippets
\Spackle\Spackle::setApiKey('<api key>');
\Spackle\PricingTable::retrieve("abcde123");
$customer = \Spackle\Customer::retrieve("cus_000000000");
$customer->enabled("feature_key");
$customer->limit("feature_key");
$customer->subscriptions();
\Spackle\Waiters::waitForCustomer("cus_00000000");
\Spackle\Waiters::waitForSubscription("cus_000000000", "sub_00000000");
\Spackle\Waiters::waitForSubscription("cus_000000000", "sub_00000000", array("status" => "active"));
\Spackle\Spackle::setStore(new \Spackle\Stores\FileStore("/app/spackle.json"));
\Spackle\Spackle::setStore(new \Spackle\Stores\MemoryStore());
\Spackle\Spackle::getStore()->set_customer_data("cus_000000000", array(
"features" => array(
array(
"type" => 0,
"key" => "flag_feature",
"value_flag" => true
),
array(
"type" => 1,
"key" => "limit_feature",
"value_limit" => 100
)
),
"subscriptions" => array(
array(
"id" => "sub_000000000",
"status" => "trialing",
"quantity" => 1
)
)
);