Skip to main content

Prerequisites

  • PHP 7.4 or higher
  • Composer (optional)
  • cURL extension enabled
  • SunLicense API credentials

Integration steps

1. Create a license validator class

2. Implementation example

3. Using a framework (Laravel example)

Best practices

  1. Error handling
    • Implement proper try-catch blocks
    • Log validation failures
    • Handle errors gracefully
  2. Caching
    • Cache validation results
    • Implement proper cache invalidation
    • Handle offline scenarios
  3. Security
    • Store the license key in environment variables
    • Implement proper error logging
    • Secure API communication

Common issues and solutions

  1. cURL errors
    • Verify the cURL installation
    • Check SSL certificates
    • Confirm the API endpoint is accessible
  2. Validation failures
    • Check license key validity
    • Verify the product ID
    • Monitor API response codes