PHP code example of sinevia / php-library-fastest

1. Go to this page and download the library: Download sinevia/php-library-fastest 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/ */

    

sinevia / php-library-fastest example snippets


// Add the actions
ctions/login_action.php');

// Execute the router
\Sinevia::fastest();

// Manually set the action and execute
$uri = strtok($_SERVER["REQUEST_URI"],'?');
$result = \Sinevia::fastest(['action' => $uri]);

// Get the result as string and output
$result = \Sinevia::fastest(['output_as_string' => true]);
die($result);

/**
 * The home function
 * route: ?a= or /
 */
function home_action {
    return 'Home';
}

/**
 * The login function
 * route: ?a=login or /login
 */
function login_action {
    return 'Login';
}


index.php?a=home (this is default)
index.php?a=register


(action: home => function: home_action)
(action: register => function: register_action)

(action: auth/login => function: auth_login_action)
(action: auth-login => function: auth_login_action)