1. Go to this page and download the library: Download nosto/php-sdk 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/ */
nosto / php-sdk example snippets
.....
try {
/** @var NostoSignupInterface $meta */
/** @var NostoSignup $account */
$account = NostoSignup::create($meta);
// save newly created account according to the platforms
if (isset($_GET['code'])) {
try {
/** @var OAuthInterface $meta */
$account = NostoSignup::syncFromNosto($meta, $_GET['code']);
// save the synced account according to the platforms / handle errors; 3 parameter will be sent, 'error', 'error_reason' and 'error_description'
// redirect to the admin page where the user can see an error message
.....
} else {
// 404
.....
}
.....
/**
* @param ConnectionMetadataInterface $connection the connection meta data.
* @param AccountInterface|null $account the configuration to return the url for.
* @param UserInterface|null $user
* @param array $params additional parameters to add to the connection url.
*/
try
{
$url = Nosto::helper('connection')->getUrl($meta, $account, $user, $params);
}
catch (NostoException $e)
{
// handle failure
}
// render the link to the user with given url
.....
.....
/**
* @var NostoProductInterface[] $products
* @var NostoSignupInterface $account
*/
$collection = new NostoExportProductCollection();
foreach ($products as $product) {
$collection[] = $product;
}
// The exported will encrypt the collection and output the result.
$cipher_text = NostoExporter::export($account, $collection);
echo $cipher_text;
// It is important to stop the script execution after the export, in order to avoid any additional data being outputted.
die();
.....
/**
* @var NostoOrderInterface[] $orders
* @var NostoSignupInterface $account
*/
$collection = new NostoExportOrderCollection();
foreach ($orders as $order) {
$collection[] = $order;
}
// The exported will encrypt the collection and output the result.
$cipher_text = NostoExporter::export($account, $collection);
echo $cipher_text;
// It is important to stop the script execution after the export, in order to avoid any additional data being outputted.
die();
bash
php composer.phar install
bash
php composer.phar install
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.