PHP code example of gabela / micro-framework

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

    

gabela / micro-framework example snippets


$router->get('/', 'HomeController::index')->pass('guest');
$router->post('/submit', 'FormController::submit')->pass('auth');
$router->post('/admin', 'AdminPageController::Index')->pass('admin');

class HomeController extends ControllerAbstract
{
    public function index()
    {
        $this->getTemplate('home');
    }
}

class User implements UserInterface
{
    // Model methods here
}

// helpers/weatherApi.php
function getCurrentWeather()
{
    // Weather fetching logic
}




namespace Gabela\Controller;

class HelloWorldController extends \Gabela\Core\AbstractController
{
    public function Action()
    {
        // Your controller logic goes here
        printValue('Hello World');
    }
}

$router->get("{$extensionPath}/hello-world", "HelloWorldController::Action")->pass('guest');

'HelloWorldController' => [
    'namespace' => 'Gabela\\Controller\\',
    'path' => BASE_PATH . '/gabela/controllers/',
],