Phalcon First Example
To create any app in phalcon, firstly you have to create a bootstrap file. Bootstrap file acts as the entry-point and configuration of the application. This file handles 3 things:
To create this file we follow four steps:
It loads the PSR-4 which consists of complaint file loader which is running through Phalcon C extension. Autoloaders add mostly Controllers and Models. We can also register directories consist of different file namespace.
Phalcon is loosely coupled framework due to which all services are registered with dependency manager. All services are delivered automatically to components and services inside the IoC (Inversion of Control) container.
All services are included in a class file DI (Dependency Injection) and IoC container consists of following concepts:
Factory Default i.e. Phalcon\Di\FactoryDefault is the variant of Phalcon\Di.
First we create the object for the DI which automatically registers most of the component.
Now, we register the "view" services with the directory address where to find the files.
Now, we generate the base URL
Application request implements MVC (Model View Controller) for the application. Under this we initialize 3 things:
Complete bootstrap file: