Micro Applications

Micro Applications

With Phalcon you can create “Micro-Framework like” applications. By doing this, you only need to write a minimal amount of code to create a PHP application. Micro applications are suitable to implement small applications, APIs and prototypes in a practical way.

use Phalcon\Mvc\Micro;

$app = new Micro();

$app->get(
    "/say/welcome/{name}",
    function ($name) {
        echo "<h1>Welcome $name!</h1>";
    }
);

$app->handle();

Creating a Micro Application

Phalcon\Mvc\Micro is the class responsible for implementing a micro application.

use Phalcon\Mvc\Micro;

$app = new Micro();

Defining routes

After instantiating the object