Book Image

Learning Phalcon PHP

Book Image

Learning Phalcon PHP

Overview of this book

Table of Contents (17 chapters)
Learning Phalcon PHP
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating the structure for our project


Now, we are going to create the structure for our project. In the first chapter, we created the /var/www/learning-phalcon.localhost folder. If you have another location, go there and create the following directory structure:

Next, let's create the index.php file that will handle our application. This file will be the default file in our web server:

<?php

header('Content-Type: text/html; charset=utf-8');
mb_internal_encoding("UTF-8");

require_once __DIR__.'/../modules/Bootstrap.php';

$app = new Bootstrap('frontend');
$app->init();
?>

In the first two lines, we set the header and internal encoding to UTF-8. This is a good practice if you are going to use special characters / diacritics. In the fourth line, we include a file named Bootstrap.php. This file is the Bootstrap of our project, and we will create its content in a few moments. On the next lines, we create a new instance of Bootstrap with a default module (frontend), and we initialize...