PHP code example of f3-factory / fatfree-psr7-factory
1. Go to this page and download the library: Download f3-factory/fatfree-psr7-factory 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/ */
f3-factory / fatfree-psr7-factory example snippets
$f3->route('GET /hallo-world', function(
Base $f3,
RequestInterface $request,
ResponseInterface $response,
StreamFactoryInterface $streamFactory
) {
$agent = $request->getHeaderLine('User-Agent');
return $response->withBody($streamFactory
->createStream('Your user agent is: '.$agent));
});
$request = $f3->make(RequestInterface::class);
// or
$request = MessageFactory::instance()->makeRequest();
// for Server Request:
$serverRequest = $f3->make(ServerRequestInterface::class);
// or
$serverRequest = MessageFactory::instance()->makeServerRequest();