{eac}SoftwareRegistry Distribution SDK is an extension plugin to {eac}SoftwareRegistry Software Registration Server.
The Software Registry Distribution SDK is used to generate a custom PHP package that you can include in your software project to register your product with your registration server and manage that registration.
A custom version of this document is included in the generated SDK package.
The SDK provides most of the PHP code you will need to implement the Application Program Interface with your Software Registration Server.
Included with the Software Registration SDK package…
(your_productid)_registration.(wordpress_or_filebased).trait.php(your_productid)_registration.includes.php(your_productid)_registration.interface.php(your_productid)_registration.interface.trait.php(your_productid)_registration.refresh.php(your_productid)_registration.readme.md
Software Registry Implementation
After extracting the (your_productid)_registration.zip file, move the (your_productid)_registration folder to your project.
In your project or class file, include (your_productid)_registration/(your_productid)_registration.includes.php to load the required interface and traits.
Your class file must then:
- implement
(your_namespace)Interfaces(your_productid)_registration - use
(your_namespace)Traits(your_productid)_registration_(wordpress_or_filebased)
Example:
(your_productid)_registration.interface.php will have your product and registration server API constants.
Using The API
API Parameters
API parameters are passed as an array:
* Required values (registry_key not required when creating a new registration).
If setting registry_transid, the recommended (not required) format is
{id}|{source}|{suffix}where {id} is the transaction id, {source} indicates the source of the transaction, and {suffix} may be used as needed.
Any additional fields passed wil be saved as custom fields.
Although typically set by the Software Registry server, with the proper option setting, the API may override:
Payment information may be posted with:
API Requests
Create/request a new registration…
Activate an existing registration…
Activate and Update an existing registration…
Deactivate an existing registration…
Verify or Refresh an existing registration…
Revise an existing registration…
API Response
The API response is a standard object. status->code is an http status, 200 indicating success.
On a successful response (status->code = 200), the SDK will automatically cache the registration data and schedule the next refresh event (you do not have to do this).
notices may be set (according to severity) to indicate an expiration or pending expiration and should be displayed to the user. Typically, only one notice will be set but they can be set via the eacSoftwareRegistry_api_registration_notices filter.
message is set via the eacSoftwareRegistry_api_registration_message filter.
supplemental is set via the eacSoftwareRegistry_api_registration_supplemental filter.
On an error response, an additional element is included:
error->message may be more informative than status->message.
Errors may be handled with something like:
Methods, Hooks, and Callbacks
Useful methods built into the SDK…
Several hooks are available to customize or react to registration events.
In WordPresss, there are several actions and filters, for file based projects there are corresponding callback methods…
What You Need To Do
For WordPress Projects
In your class constructor/initialization, add an action to fulfill the registration refresh scheduled by the scheduleRegistryRefresh() method in (your_productid).wordpress.trait.php
You can add this and other hooks with:
The addSoftwareRegistryHooks() method adds:
Example:
Note:
If your primary plugin file name is not the same as the product id, edit your (your_productid).interface.tpl file and change the SOFTWARE_REGISTRY_FILENAME constant.
For Other File Based Projects
The scheduleRegistryRefresh() method in (your_productid)_registration.filebased.trait.php is called to schedule the next registration refresh. This method can be modified to schedule a cron event to execute the refresh at a future time. The scheduled event may run (your_productid)_registration.refresh.php <registrationKeyValue> from the command line to refresh the registration.
When left as is, the checkRegistryRefreshEvent() method uses the key file to check for a needed registration refresh.
In your class constructor or destructor add:
to trigger the refresh check.
Example:
User Interface
Of course, the user interface is up to you, the developer, but you may look at (and maybe use) the registration UI trait included with {eac}Doojigger and used by {eac}SoftwareRegistry as an example.
see:
- …/Traits/swRegistrationUI.trait.php in the eacDoojigger folder.
- …/Extensions/class.eacSoftwareRegistry_registration.extension.php in the eacSoftwareRegistry folder.
See Also
Copyright
Copyright ? 2019-2025, EarthAsylum Consulting, distributed under the terms of the GNU GPL.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should receive a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

评论0