Download the PHP package xultech/devpayr-php-sdk without Composer

On this page you can find all versions of the php package xultech/devpayr-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package devpayr-php-sdk

DevPayr PHP SDK

A lightweight and developer-friendly PHP SDK for integrating the DevPayr platform β€” allowing you to validate license keys, fetch injectables, manage projects, control domains, enforce payments, and more.

Designed for software creators, SaaS founders, and digital product developers who want to secure and monetize their code with minimal effort.

πŸ”° Introduction

DevPayr is a modern software licensing and payment enforcement platform built to help developers protect their code, enforce payment, and control how their software is used β€” across PHP, JavaScript, desktop, and SaaS environments.

This SDK enables seamless integration with DevPayr directly from your PHP application. Whether you're selling a script, distributing software, or building a SaaS, this SDK gives you the tools to:

πŸš€ Why Use DevPayr SDK?

Manually enforcing license checks, domain locks, and payment validation can be error-prone, time-consuming, and easily bypassed.

The DevPayr SDK solves this with:

βœ… One-Line Bootstrapping – Validate license, check payment, auto-handle injectables in a single call
βœ… Secure Runtime Validation – Block unauthorized use and unpaid projects at runtime
βœ… Customizable Failure Modes – Redirect, log, silently fail, or show a branded modal on license failure
βœ… Injectable Decryption – Distribute sensitive data like config, templates, or code snippets securely
βœ… Developer-Friendly API – Create, revoke, validate licenses and domains easily from your app
βœ… Built-in Caching – Avoid repeated license checks with intelligent cache

Whether you're distributing self-hosted scripts, WordPress plugins, SaaS dashboards, or internal tools β€” DevPayr SDK brings enforcement, control, and peace of mind.

πŸ”§ Features

πŸ“¦ Installation

Install via Composer

To install the DevPayr PHP SDK in your project, run the following command:

This will pull in the latest version of the SDK from Packagist and make it available for use in your PHP application.

πŸ“‹ Minimum Requirements

Before installing the SDK, ensure your environment meets the following requirements:

⚑ Quick Start

The DevPayr PHP SDK is designed for simple drop-in usage.

Below is a minimal working example that:

  1. Validates the license
  2. Checks if the project is paid
  3. Fetches and handles any associated injectables

This will automatically:

  • Validate the license
  • Check for active payment
  • Download and decrypt injectables (if enabled)
  • Handle failures based on your configuration

πŸ›  Configuration Options

The DevPayr::bootstrap() method accepts a flexible configuration array that tailors how validation, payment enforcement, and injectables are handled.

βœ… Required Keys

Key Type Description
base_url string The base API URL (defaults to https://api.devpayr.com/api/v1/)
secret string The secret key used to decrypt injectables (this is created when you add an injectable)

🧰 Optional Keys (with Defaults)

Key Type Default Description
recheck bool true Revalidate license on every load (false enables caching)
injectables bool true Whether to fetch injectables from the server
injectablesVerify bool true Verify HMAC signature on injectables
injectablesPath string|null null Directory where injectables are saved (default: system temp path)
invalidBehavior string 'modal' Behavior on invalid license: modal, redirect, log, silent
redirectUrl string|null null Redirect URL on invalid license (used when invalidBehavior = redirect)
timeout int 1000 Request timeout in milliseconds
action string 'check_project' Action passed to DevPayr (for tracking/analytics)
onReady callable|null null Callback function executed on successful license validation
handleInjectables bool false If true, SDK will auto-process injectables into your file system
injectablesProcessor string|null null Fully qualified class name to handle injectable processing manually
customInvalidView string|null null Absolute path to your custom HTML view to show on license failure
customInvalidMessage string 'This copy is not licensed for production use.' Message displayed on failure when no view is provided
license string|null null License key for project-scoped validation
api_key string|null null API key (global or project scoped) for backend operations
per_page int|null null Number of items to return for paginated results (used in services)

πŸ”’ You only need to set what's relevant to your use-case. Defaults will handle most basic setups.

βš™οΈ Runtime Boot & Validation

The SDK provides a simple bootstrapping method to handle license validation, payment enforcement, and injectable fetching in one unified call.

βœ… DevPayr::bootstrap(array $config): void

This is the recommended entry point. It performs:

  1. License Key or API Key Detection (if not explicitly set)
  2. Domain Validation (if enforced via DevPayr)
  3. Project Payment Check
  4. Injectables Retrieval & (Optional) Processing
  5. Runtime Enforcement based on your invalidBehavior

πŸ“¦ Example Usage

This will block further execution automatically if the license is invalid or payment is not confirmed.

πŸ”’ License or API Key

DevPayr will always utilize license key when validating a project; however, for every other actions, the API Key would be required. Consult our Documentation for more information about this - DevPayr Doc

πŸ“₯ Injectables Handling

Injectables are encrypted files or snippets tied to a project or license, securely managed through the DevPayr platform. These could include:

The SDK automatically fetches injectables during DevPayr::bootstrap() if the injectables option is true.

🧩 How It Works

When bootstrapping:

  1. The SDK requests injectables from DevPayr.
  2. They are decrypted using your provided secret key.
  3. If handleInjectables is enabled, each injectable is written to the target location based on its target_path, slug, and mode.

You may choose to either:


βš™οΈ Modes Supported

Each injectable supports a mode, which determines how it’s written:

Mode Description
replace Replaces the entire file with new content
append Appends to the end of the target file
prepend Prepends to the beginning of the file
inject (Reserved for future support: marker-based)
inline_render Intended for rendering, not saving
stream Stream to output, not saved
Others Default to replace

πŸ“‚ File Types

Injectables support multiple types including:

Only file types support actual file uploads. Others are content-based.


πŸ›  Custom Injectable Processor (Optional)

If you need to control how injectables are stored (e.g. save to DB, S3, cache, etc), define a custom processor class, which implements the InjectableProcessorInterface contract

Then reference it in config:

πŸ” Handling License Failure

When a license is invalid, expired, unverified, or the associated project has not paid, the SDK halts normal execution and responds according to the invalidBehavior config option.

You can choose what happens in such scenarios using:

🎭 Supported Behaviors

Behavior Description
modal Displays a branded HTML message or modal (default)
redirect Redirects the user to a custom URL
log Logs the failure to error_log() or stdout (if applicable)
silent Fails silently β€” no output, just skips execution

🧩 Additional Options

You can configure fallback behaviors further:

Config Key Description
redirectUrl Where to redirect when behavior is redirect
customInvalidMessage Message to display when using the default modal view
customInvalidView Path to your own custom HTML to show instead of the default unlicensed.html

Example:

πŸ’‘ Pro Tip

You can also define an onReady() callback that will only run if validation passes:

🧰 Available Services

DevPayr provides dedicated service classes for working with various parts of your licensing system β€” including projects, licenses, domains, injectables, and payment verification.

Each service class can be used independently or accessed via the DevPayr:: static methods after bootstrap().

βœ… Accessing Services After Bootstrapping

Once you've bootstrapped with a valid configuration:

Each of these returns a strongly typed service class:

Service Class Description
DevPayr::projects() ProjectService Manage projects: list, create, update, delete
DevPayr::licenses() LicenseService Create, revoke, or validate license keys
DevPayr::domains() DomainService Manage domain restrictions for your projects
DevPayr::injectables() InjectableService Fetch and manage encrypted injectables
DevPayr::payments() PaymentService Check payment status for licenses or projects

🧠 These services are authenticated using the same config object passed to DevPayr::bootstrap(). You can also instantiate them manually if needed.

πŸ“¦ Service API Examples

Below are real-world examples of how to use each core service within the DevPayr SDK to interact with your projects, licenses, domains, injectables, and payment status.


πŸ”Ή ProjectService

πŸ”Ή LicenseService

πŸ”Ή DomainService

πŸ”Ή InjectableService

πŸ”Ή PaymentService

These examples show how you can build powerful integrations and admin tools around your software licensing β€” right from your own dashboard or script.

🧩 Custom Injectable Processor

DevPayr allows you to define your own injectable processor β€” so you can decide what to do with each decrypted file (e.g. store in memory, write to disk, upload to cloud).

Instead of using the default file-based processor, you can implement the following interface:

🧱 Example: Create Your Custom Processor

βš™οΈ Registering Your Processor

Pass your class via the injectablesProcessor config key:

πŸ’‘ Use Cases

Here are some ways you can use a custom injectable processor:

πŸ”„ Note: This method is invoked per injectable, allowing you to handle each file individually and flexibly.

❗ Error Handling

The DevPayr PHP SDK uses structured exceptions to help you handle issues like license failure, API errors, and decryption problems gracefully.

πŸ”Ή Common Exceptions

Exception Description
DevPayrException Base exception for all SDK-related logic or configuration errors
ApiResponseException Thrown when the DevPayr API returns an error, bad payload, or HTTP failure

βœ… Both exceptions implement standard PHP \Throwable, so you can catch them with try/catch.


πŸ”Έ Example: Catching Runtime Errors

βš™οΈ Advanced Usage

For developers building more dynamic or complex applications, the DevPayr PHP SDK provides several advanced options for customization and integration.


πŸ” Enable/Disable Revalidation

By default, DevPayr caches validation results for a short period (using your OS temp folder) to avoid repeated network requests.

You can disable rechecking and force revalidation on every boot:

πŸ“¦ Custom Injectables Folder

By default, injectables are saved to the system temp folder. You can change where they’re stored:

🧩 Handle Injectables Yourself

If you want full control over how injectables are stored or interpreted:

πŸ’‘ See Custom Injectable Processor for how to define your own handler.

🧠 Runtime Callback (onReady)

Run custom logic only if validation succeeds:

πŸ” License Key vs API Key

πŸ” You can use either:

βœ… Both can be used separately or together, depending on your need .

🀝 Contributing

We welcome contributions to the DevPayr PHP SDK! Whether you want to fix a bug, add a feature, improve documentation, or share feedback β€” your input is valuable and appreciated.

πŸ›  How to Contribute

  1. Fork the Repository

    Start by clicking the "Fork" button on GitHub and clone your forked repository:

  2. Install Dependencies Make sure you have Composer installed, then run:

  3. Create a New Branch

Use a descriptive name for your branch based on the type of contribution:

  1. Make Your Changes

Write clear, concise, and well-documented code. Please ensure the following:

  1. Test Your Changes

If your change is code-related, add tests if possible and run:

  1. Commit and Push

Use meaningful commit messages:

  1. Open a Pull Request

Once you're satisfied with your changes, go to your fork on GitHub and click "Compare & pull request". Please include:


πŸ§ͺ Guidelines


πŸ’¬ Need Help?

If you're unsure how or what to contribute:


πŸ›‘ Code of Conduct

We follow the Contributor Covenant Code of Conduct. By participating, you agree to:

πŸ” Security

We take the security of DevPayr and its SDKs seriously.

If you discover any security vulnerability, please do not disclose it publicly. Instead, follow responsible disclosure by reporting it directly to us.

πŸ“¬ Report a Vulnerability

We will respond promptly to investigate, validate, and address the issue.

πŸ” Responsible Disclosure

We appreciate ethical researchers and developers who help make the platform safer for everyone. Your report will be treated with respect, and we may acknowledge your contribution (unless you prefer otherwise).

Thank you for helping keep DevPayr secure.


All versions of devpayr-php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
ext-curl Version *
guzzlehttp/guzzle Version ^7.0 || ^8.0
symfony/filesystem Version ^7.3
ext-openssl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package xultech/devpayr-php-sdk contains the following files

Loading the files please wait ....