1. Go to this page and download the library: Download hawkbit/presentation 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/ */
hawkbit / presentation example snippets
use \Hawkbit\Application;
use \Hawkbit\Presentation\PresentationService;
use \Hawkbit\Presentation\Adapters\PlatesAdapter;
use \Hawkbit\Presentation\Adapters\Adapter;
$app = new Application(s',
]);
$app[PresentationService::class] = new PresentationService($app->getContainer());
use \Hawkbit\Application;
use \Hawkbit\Presentation\PresentationService;
use \Hawkbit\Presentation\Adapters\PlatesAdapter;
use \Hawkbit\Presentation\Adapters\Adapter;
use \Hawkbit\Presentation\Adapters\Psr7WrapperAdapter;
$app = new Application(ServerRequestInterface::class],
$app[\Psr\Http\Message\ResponseInterface::class]);
$app[PresentationService::class] = new PresentationService($app->getContainer());
use Hawkbit\Presentation\PresentationService;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
class MyController
{
/**
* @var PresentationService
*/
private $presentationService;
/**
* TestInjectableController constructor.
* @param PresentationService $presentationService
*/
public function __construct(PresentationService $presentationService)
{
$this->presentationService = $presentationService;
}
public function getIndex(ServerRequestInterface $request, ResponseInterface $response, array $args = [])
{
// configured with PSR-7 adapter
return $this->presentationService->render('index', ['world' => 'World']);
}
}
use Hawkbit\Presentation\PresentationService;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
class MyController
{
/**
* @var PresentationService
*/
private $presentationService;
/**
* TestInjectableController constructor.
* @param PresentationService $presentationService
*/
public function __construct(PresentationService $presentationService)
{
$this->presentationService = $presentationService;
}
public function getIndex(ServerRequestInterface $request, ResponseInterface $response, array $args = [])
{
// manipulate response
// for example we need to add an api key
$response = $response->withHeader('API-KEY', 123);
// configured with PSR-7 adapter
return $this->presentationService->render('index', ['world' => 'World'], $response);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.