PHP code example of upcloo / micro-framework

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

    

upcloo / micro-framework example snippets



$loader = Your", __DIR__ . '/../src');

$config = new UpCloo\App\Config\ArrayProcessor();
$config->appendConfig(p->run();



return array(
    "router" => array(
        "routes" => array(
            "home" => array(
                "type" => "Literal",
                "options" => array(
                    "route" => "/walter",
                    'defaults' => array(
                        'controller' => 'Your\\Controller\\Name',
                        'action' => 'hello'
                    )
                ),
                'may_terminate' => true,
            )
        )
    ),
    "services" => array(
        "invokables" => array(
            "Your\\Controller\\Name" => "Your\\Controller\\Name",
        ),
        "factories" => array(
            "example" => function(\Zend\ServiceManager\ServiceLocatorInterface $sl) {
                return "hello";
            }
        ),
    )
);


namespace Your\Controller;

use UpCloo\Controller\ServiceManager;

class Name
{
    use ServiceManager;

    public function hello()
    {
        $hello = $this->services()->get("example");
        return $hello . " " . "world";
    }
}

php -S localhost:8080 -t web/ web/index.php