1. Go to this page and download the library: Download guide42/ochenta 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/ */
guide42 / ochenta example snippets
use ochenta\ServerRequest;
use function ochenta\{emit, responder_of};
emit(new ServerRequest, responder_of('Hello World'));
$req = new ServerRequest;
$req = new ServerRequest($_SERVER, $_GET, $_POST, $_FILES, $_COOKIE, fopen('php://input', 'rb'));
responder_of(Response $resource) // creates a responder from a Response
responder_of(resource $resource) // ... from a resource
responder_of(scalar $resource) // ... from content
emit(ServerRequest $req, callable $handler) // emits a responder
stack(callable $responder, array $stack) // expects stack items to be a function(callable $next)
stack(callable $responder, callable $resolver, array $stack) // ... use resolver as function(callable $prev, $handler)
// MIDDLEWARES
header(string $name, array $values) // adds a header to responder
header(string $name, string $value) // ... with single value
cookie(Cookie $cookie) // sets cookie into responder
append(string $content) // adds content before body
append(string $content, string $tag) // ... before every given tag
// RESPONDERS
redirect(string $uri) // redirect to the given url
redirect(string $uri, int $statusCode) // ... with given status code
// CONTENT NEGOTATION
accept\mediatypes(Request $req, array $available) // negotiate media types
accept\charsets(Request $req, array $available) // ... charsets
accept\encodings(Request $req, array $available) // ... encodings
accept\languages(Request $req, array $available) // ... languages
// HELPERS
stream_of(scalar $resource) // creates tmp file with $resouce content
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.