PHP code example of rcs_us / slim-middleware-basic-acl
1. Go to this page and download the library: Download rcs_us/slim-middleware-basic-acl 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/ */
rcs_us / slim-middleware-basic-acl example snippets
$app = new \Slim\App;
// .... implement HTTP Authentication , IE $app->add(new \Slim\Middleware\HttpBasicAuthentication( ...
// array of usernames
$app->get("/path/of/your/route", "\App\Controller\SomeController:methodToCall")->add(new \Slim\Middleware\HttpBasicACL(["username1", "username2"]));
// callable
$app->get("/path/of/your/route", "\App\Controller\SomeController:methodToCall")->add(new \Slim\Middleware\HttpBasicACL(function ($request, $response) {
// Some Logic Here Based On $_SERVER["PHP_AUTH_USER"] | $request->getServerParams()["PHP_AUTH_USER"] .
// Returning false will trigger a 403, true will execute route
return false;
}));