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

Cleaning the Core module


Let's also clean our Core module. We will use this folder as a collection of libraries instead of using it as a module. First, remove the following files:

modules/Core/Config/config.php
modules/Core/Config/services.php
modules/Core/Controllers/IndexController.php
modules/Core/Module.php

Then remove these lines from modules/Bootstrap.php:

'core' => array(
    'className' => 'App\Core\Module',
    'path' => __DIR__.'/Core/Module.php',
),

Now we have a clean core and our bootstrap will not register it as part of our modules any more. We will make modifications to modules/Core/Controllers/BaseController.php and modules/Backoffice/Controllers/BaseController.php so that this controller will extend modules/Core/Controllers/BaseController.php:

  • In the modules/Api/Controllers/BaseController.php file:

    <?php
    namespace App\Api\Controllers;
    
    use Phalcon\Http\Response;
    
    class BaseController extends \App\Core\Controllers\BaseController
    {
      // code
    }
  • In the modules/Backoffice...