SearchTable Of ContentsPrevious topicClass Phalcon\Mvc\Dispatcher\Exception Next topicClass Phalcon\Mvc\Micro\Exception This Page |
Class Phalcon\Mvc\Micro¶extends Phalcon\DI\Injectable implements Phalcon\Events\EventsAwareInterface, Phalcon\DI\InjectionAwareInterface 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 small applications, APIs and prototypes in a practical way. <?php
$app = new Phalcon\Mvc\Micro();
$app->get('/say/welcome/{name}', function ($name) {
echo "<h1>Welcome $name!</h1>";
});
$app->handle();
Methods¶public __construct () Phalcon\Mvc\Micro constructor public setDI (Phalcon\DiInterface $dependencyInjector) Sets the DependencyInjector container public map (string $routePattern, callable $handler) Maps a route to a handler without any HTTP method constraint public get (string $routePattern, callable $handler) Maps a route to a handler that only matches if the HTTP method is GET public post (string $routePattern, callable $handler) Maps a route to a handler that only matches if the HTTP method is POST public put (string $routePattern, callable $handler) Maps a route to a handler that only matches if the HTTP method is PUT public head (string $routePattern, callable $handler) Maps a route to a handler that only matches if the HTTP method is HEAD public delete (string $routePattern, callable $handler) Maps a route to a handler that only matches if the HTTP method is DELETE public options (string $routePattern, callable $handler) Maps a route to a handler that only matches if the HTTP method is GET public notFound (callable $handler) Sets a handler that will be called when the router doesn’t match any of the defined routes public Phalcon\Mvc\RouterInterface getRouter () Returns the internal router used by the application public object getService (unknown $serviceName) Obtains a service from the DI public getSharedService (unknown $serviceName) Obtains a shared service from the DI public mixed handle (string $uri) Handle the whole request public setActiveHandler (callable $activeHandler) Sets externally the handler that must be called by the matched route public callable getActiveHandler () Return the handler that will be called for the matched route public mixed getReturnedValue () Returns the value returned by the executed handler public Phalcon\DiInterface getDI () inherited from Phalcon\DI\Injectable Returns the internal dependency injector public setEventsManager (Phalcon\Events\ManagerInterface $eventsManager) inherited from Phalcon\DI\Injectable Sets the event manager public Phalcon\Events\ManagerInterface getEventsManager () inherited from Phalcon\DI\Injectable Returns the internal event manager public __get (string $propertyName) inherited from Phalcon\DI\Injectable Magic method __get |