PHP code example of skpassegna / old-freemius-php-sdk
1. Go to this page and download the library: Download skpassegna/old-freemius-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/ */
skpassegna / old-freemius-php-sdk example snippets
Freemius\Freemius;
use Freemius\Exceptions\Freemius_Exception;
// Your Freemius credentials (obtain these from your Freemius dashboard)
$scope = 'plugin'; // Use 'developer' if working across multiple plugins, 'install' for a single installation, or 'user' for user-related actions.
$id = YOUR_PLUGIN_ID; // Replace with your plugin/developer/install/user ID, depending on the scope.
$publicKey = 'pk_YOUR_PUBLIC_KEY'; // Replace with your public key
$secretKey = 'sk_YOUR_SECRET_KEY'; // Replace with your secret key
$isSandbox = false; // Set to true for sandbox mode
$fs = new Freemius($scope, $id, $publicKey, $secretKey, $isSandbox);
try {
if ($fs->Test()) { // Test Connectivity to Freemius API
echo "Freemius connection successful!\n";
$plugin = $fs->Api('/.json'); // Retrieves current plugin's information (potentially logging the error or displaying a user-friendly message.
// You can access more details about the error using $e->getResult().
} catch (\Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
// Handle other exceptions
}