Neues Projekt: Codeigniter wegen Symfony 2

Ich habe noch 1 Woche Zeit. Die Aufgabe ist, diese kleine MVC Projekt:

In Codeigniter MVC, nach Symfony 2 MVC framework Weiterentwicklung

Dann Ich freue ich mich sowohl in Bezug auf die Frameworks vergleichen in Hinsicht auf:

  • Geschwindigkeit
  • Struktur und Data Models
  • und wie schwer ist es, eine Admin-Panel zu Entwickeln
    (and how hard is to code an admin panel, in case my german is not so clear)


How to add Bonfire to an existing Codeigniter framework project

MISSION: Integrate simple codeigniter project
with bonfire powerfull HMVC modules and administration access.

Step 1

Copy application and bonfire folders into project root.


Step 2

Modify existing MY_loader class that will be overridden by Step 1 with your custom functions. In my case, I was using sparks library and the existing codeigniter theme functionality. So I left :


/* load the MX_Loader class */
require APPPATH.”third_party/MX/Loader.php”;

/* This will be class MY_Loader extends CI_Loader {}  in your Codeigniter project */

class MY_Loader extends MX_Loader {

// And copied here my custom methods.


Step 3

Routing and class names:

http:/onstage/public/index.php/event/hamburg/215  (Local test)
Fatal error: Cannot redeclare class Events in C:\xampp\htdocs\onstage\bonfire\libraries\events.php on line 33

Small fail: It seems bonfire already has a class called events. And collides with my own events controller…So I will rename it to something else and change routing accordingly.

So, we update the route:
$route[‘event/(:any)/(:num)’] = “eventos/lookup/$1/$2″;
And the corresponding file controllers/events.php to eventos.php . This is the beautiful part of MVC. We just changed some files and routing, but the URL call will be exactly the same. This internal changes won’t affect at all any frontend functionality.

Ok and now the latest routing update, this time in the apache virtual host, the codeigniter goes to the root. But the Bonfire default is the public directory.

With this change, so far, almost all old codeigniter project is working like before, with the added plus that now has a Bonfire administration. But we have still some routes to correct.
For example, the old city route is no longer working:

Drops a 404. But the application/config/routes.php are there :
$route[‘hamburg’] = “home/hamburg”;
$route[‘munich’]    = “home/munich”;

And the home controller has those methods inside. So I yet have to find those.


The solution to my path problem was solved in two steps:

a)  First changing the application/config.php and removing the index.php page from the index_page variable:
$config[‘index_page’] = ”;

b)  Modifying the view paths to css / js external HTML resources, referring to step 2 since bonfire goes to /public as default:

<link rel=”stylesheet” href=”/public/css/alpha_background.css”>  So now new route will be :
<link rel=”stylesheet” href=”css/alpha_background.css”>

After this I had running in the front exactly as before, with the benefit of having a complete bonfire admin in the back-end.

I’ve posted this in the bonfire forum to see if I can get some feedback and also to share with others, since this is a completely open project where all changes will be shared on a github account where anyone can fork, edit, and comment on changes.