• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to organize applications ?

#1
What would be recommended for developing a complex application, would everything be within the framework or would it use the framework for each subapplication ?

Reply

#2
It really depends on what type of application it is.

You could have and application that has separate backend and frontend.

In CodeIgniter 4 we now have modules so we can divide our applications
into modules.

Example

Admin Module
Blog    Module
CMS    Module
etc;

CodeIgniter 4 is just about ready to be released soon so I would start by
designing my new application using CodeIgniter 4 and modules.

That is what I' am doing using now. Building my admin dashboard using
AdminLTE.

The nice thing about using modules is that once made they are reusable.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
so the modules are in the root of the framework. And as would be the structure of CI, I refer to the directories controllers, models, view and others. Would they stay within each module ?

Reply

#4
This is how my modules are laid out.

app
Insitefx
-- Admin - Module
---- Config
---- Controllers
---- etc;
-- Blog - Module
---- Config
---- Controllers
---- etc;
public_html
-- assets
-- index.php
system
writable

I use my name as the main namespace.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#5
Yes,

app
public
system
etc;

Your_name or Company name ( root namespace )
-- Module_name ( Admin )
---- Config
---- Controllers
---- Database
---- Entities
---- Filters
---- Helpers
---- Language
---- Libraries
---- Models
---- Views


A module consists of almost the whole app folder, except you only need the folders
that you are going to use.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#6
In that case how would you interconnect modules? For instance you have a admin structure and a user structure. What if a admin also has some functionality of the user? Is their a way to let the modules (if i can call them that) speak with eachother?
Reply

#7
Any module can access any other module there all just classes and name spaced.

This is why you try to keep all your business logic in your models then any module can access
the models.

But any module class can call any class in your application.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#8
Thank you for this thread. I have installed CI4 today with the intention to migrate my sprawling php project scripts.

My project is split into 2 distinct parts.
Public Pages
Admin Area

Given the above explanation it is my intention to do the following:
1)Create a admin folder in the root and copy all app folders/files to the new admin folder

2)Use default namespace and develop all public pages in app folder

Having done this, and having changed admin/config/app.php from public $baseURL = 'http://mydomain/'; to $baseURL = 'http://mydomain/admin/'; I am running into a 404 error when trying to access http://mydomain/admin/ that states Controller or its method is not found: App\Controllers\Admin::index

I'm a little confused as I want to be able both http://mydomain/ and http://mydomain/admin/ independantly.

What am I missing?
Reply

#9
You need to create a Config/Routes.php in your Admin folder like above.

This is how I started my Routes this is still a work in progress.

Just an Example below.

PHP Code:
<?php

/**
 * Insitefx/Admin: routes file.
 */

$routes->group('', ['namespace' => 'Insitefx\Admin\Controllers'], function($routes)
{
    $routes->get('admin''Admin::index');
    $routes->get('admin/(:any)''Admin::view/$1');

    $routes->get('dashboard''Admin::dashboard', ['as' => 'dashboard']);

}); 

In the route group above change to your namespace.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#10
ahhh! that make sense.



Many thanks.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.