PHP code example of arsengoian / viper-framework

1. Go to this page and download the library: Download arsengoian/viper-framework 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/ */

    

arsengoian / viper-framework example snippets


if (Config::get('DEBUG'))     // From local.yaml -> local.yaml and global.yaml don't need a preffix
    return Config::get('Bots.VERIFY_TOKEN')    // From bots.yaml

public function post (...$args): ?Viewable
{
    $v = new Required($this -> params());                                 // Create validator
    $v -> email('email');                                                 // Validate "email" field

    Client::registerWithImages($this -> params(), $this -> files());      // Create new model in the database
    return new RedirectView('/');                                         // Redirect to main page
}

class Application extends \Viper\Core\Application
{
    /**
     * Defines the list of filters to be run
     * before any controller actions
     * @return FilterCollection
     */
    protected function declareFilters (): FilterCollection
    {
        return new FilterCollection([
            LocalizationFilter::class,
            Authorization::class
        ]);
    }
}