Paystack.php 716 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace Paystack;
  3. use Paystack\Http\HttpClient;
  4. class Paystack
  5. {
  6. private static $apiKey;
  7. const API_URL = 'https://api.paystack.co';
  8. public static function init($apiKey)
  9. {
  10. //setup API Key
  11. self::setApiKey($apiKey);
  12. //set default request httpclient
  13. Request::setClient(new HttpClient());
  14. }
  15. /**
  16. * @return mixed
  17. */
  18. public static function getApiKey()
  19. {
  20. return self::$apiKey;
  21. }
  22. /**
  23. * @param mixed $apiKey
  24. */
  25. public static function setApiKey($apiKey)
  26. {
  27. self::$apiKey = $apiKey;
  28. }
  29. public static function api($resourceUrl)
  30. {
  31. return self::API_URL.$resourceUrl;
  32. }
  33. }
  34. ?>