1. Go to this page and download the library: Download minetro/mobilni-platby library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
minetro / mobilni-platby example snippets
declare(strict_types = 1);
namespace Your\App;
use Contributte\MobilniPlatby\IDispatcher;
use Contributte\MobilniPlatby\Request\AbstractRequest;
use Contributte\MobilniPlatby\Response\AbstractResponse;
use Contributte\MobilniPlatby\Response\Response;
class TestDispatcher implements IDispatcher
{
public function dispatch(AbstractRequest $request): AbstractResponse
{
return new Response('This is super!');
}
}
declare(strict_types = 1);
namespace Your\App\Presenters;
use Contributte\MobilniPlatby\Dispatcher\CallbackDispatcher;
use Contributte\MobilniPlatby\Request\ConfirmRequest;
use Contributte\MobilniPlatby\Request\RequestFactory;
use Contributte\MobilniPlatby\Request\SmsRequest;
use Contributte\MobilniPlatby\Response\AbstractResponse;
use Contributte\MobilniPlatby\Response\ConfirmResponse;
use Contributte\MobilniPlatby\Response\Response;
use Nette\Application\UI\Presenter;
class SmsPresenter extends Presenter
{
public function actionSms1(): void
{
$requestFactory = new RequestFactory($this->getHttpRequest());
$dispatcher = new TestDispatcher();
$this->sendResponse($dispatcher->dispatch($requestFactory->create()));
}
public function actionSms2(): void
{
$requestFactory = new RequestFactory($this->getHttpRequest());
$dispatcher = new CallbackDispatcher();
$dispatcher->registerSmsCallback(function (SmsRequest $request, Response $response): AbstractResponse {
return new Response('My response!');
});
$dispatcher->registerConfirmCallback(function (ConfirmRequest $request, ConfirmResponse $response) {
return new ConfirmResponse();
});
$this->sendResponse($dispatcher->dispatch($requestFactory->create()));
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.