Welcome to the DevPayr PHP SDK! This lightweight SDK helps you integrate with DevPayr to manage licenses, enforce payments, and protect your software efficiently.
- Introduction
- Features
- Installation
- Usage
- License Management
- Payment Enforcement
- Injectables Management
- Domain Locking
- Contributing
- Support
- Releases
The DevPayr PHP SDK offers developers a straightforward way to integrate payment and license management features into their PHP applications. With this SDK, you can validate licenses, manage injectables, and enforce payment seamlessly.
- License Validation: Ensure that your users have valid licenses for your software.
- Payment Enforcement: Automatically enforce payment rules for your services.
- Injectables Management: Manage and protect your software components effectively.
- Domain Locking: Secure your software by locking licenses to specific domains.
To install the DevPayr PHP SDK, you can use Composer. Run the following command in your terminal:
composer require devpayr/php-sdk
If you prefer, you can download the SDK directly from the Releases section and execute the setup file.
After installation, you can start using the SDK in your PHP application. Here’s a simple example to get you started:
require 'vendor/autoload.php';
use DevPayr\SDK;
$devPayr = new SDK('your-api-key');
// Validate a license
$license = $devPayr->validateLicense('license-key');
if ($license->isValid()) {
echo "License is valid!";
} else {
echo "Invalid license.";
}
License management is a core feature of the DevPayr SDK. You can easily validate and manage licenses for your software products.
To validate a license, use the validateLicense
method:
$license = $devPayr->validateLicense('your-license-key');
You can also check the status of a license:
if ($license->isActive()) {
echo "License is active.";
} else {
echo "License is inactive.";
}
Enforcing payments is essential for any software service. The SDK provides simple methods to handle payment enforcement.
You can enforce a payment for a user by calling:
$payment = $devPayr->enforcePayment('user-id', 'amount');
To check if a payment was successful:
if ($payment->isSuccessful()) {
echo "Payment was successful.";
} else {
echo "Payment failed.";
}
Managing injectables is crucial for protecting your software. The SDK allows you to manage these components effectively.
To add an injectable, use:
$devPayr->addInjectable('injectable-name', 'injectable-value');
To retrieve an injectable, you can call:
$value = $devPayr->getInjectable('injectable-name');
Domain locking helps secure your software by tying licenses to specific domains. This ensures that only authorized users can access your software.
To lock a license to a domain:
$devPayr->lockLicenseToDomain('license-key', 'your-domain.com');
If you need to unlock a license:
$devPayr->unlockLicense('license-key');
We welcome contributions to the DevPayr PHP SDK! If you want to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them.
- Push your changes to your fork.
- Create a pull request.
Please ensure that your code adheres to our coding standards and includes tests where applicable.
If you have any questions or need support, please open an issue in the GitHub repository. We will respond as soon as possible.
For the latest releases, visit the Releases section. Here you can download the latest version of the SDK and see the changelog for updates.
We hope you find the DevPayr PHP SDK useful for your projects. Enjoy coding!