PHP code example of mheap / silex-security

1. Go to this page and download the library: Download mheap/silex-security 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/ */

    

mheap / silex-security example snippets




$app = new Silex\Application();

$app['mheap.security.open_routes'] = array(
    "index" => "^/$"
);

$app['mheap.security.pages'] = array(
    "login" => "/login",
    "logout" => "/logout",
    "login_redirects_to" => "/"
);

$app['mheap.security.user_provider'] = $app->share(function() use ($app) {
    return new mheap\UserProvider;
});

$app->register(new mheap\SecurityServiceProvider());

$app->get('/login', function () use ($app) {
    return "FOO";
});