PHP code example of unofficialmc2 / foundation-api
1. Go to this page and download the library: Download unofficialmc2/foundation-api 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/ */
unofficialmc2 / foundation-api example snippets
return [
"logger" => [
"name" => "nom du projet", // [obligatoire] necessaire pour les logs multi projets
"path" => "chemin/vers/dossier/de/log"
]
];
$settings = [...];
$app = \Api\Factory::create($settings);
class SampleMiddleware extends \Api\Middleware
{
/**
* @inheritDoc
*/
public function __invoke(Request $request, RequestHandler $handler): Response
{
// Faire qqchose avant le process
$response $handler->handle($request);
// Faire qqchose après le process
return $response;
}