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.

$app = new Phalcon\Mvc\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.

$app = new Phalcon\Mvc\Micro();

Defining routes

After instantiating the object, you will need to add some routes. 登录查看完整内容