I have used Codeigniter for several years and now use it with Modular Extensions HMVC which allows me to have separate modules with their own controllers, models and views.
I haven't used Kohana before, and am trying to figure out if it is possible to do this type of HMVC with Kohana 3. I know it uses modules, but I'm not sure if it's modules in this same kind of HMVC context or not?
I basically need to do things where you can basically drop in a module that would have its own controllers, models, views, etc. Would Kohana work for something like that?
Yes, Kohana has a cascading filesystem, you can get more details # http://kohanaframework.org/3.2/guide/kohana/files
Related
I'm new to Laravel, in codeigniter we can use something like HMVC to make our code modular and reusable. what is the best approach in laravel? for example lets say i created a artwork gallery, how can i use it in my next projects as a module?
I have to install 10+ APIs in my third_party folder, each has it´s own examples files for testing oauth validation and other features.
without too many changes, has anyone found an easy way to hack the Codeigniter routing to execute files like
$route['hackToken'] = "/application/third_party/googleads-php-lib-master/examples/AdWords/Auth/GetRefreshToken.php";
Codeigniter expects to find a class derived from Controller at the target of a route. So, you will not be able to do this unless you create a Controller for each example.
I have been doing a lot of research on MVC and file structure. Mainly I've been looking at how to start a new layout. I have downloaded a few open source applications to take a look at file structure and how files are developed.
In the first application it was set up to use the standard way (at least the way it seems to me) of putting all the controllers, models and views each in their respective folders. This is the way that all the books say to do it.
In the second application, all folders are in a modules_core or modules folder where each controller (at least what I would assume to be controllers) are in a folder in there that contain three folders: controller, model, view.
Which of the two versions is accepted as standard and common practice? Are the two applications different because of versions of Codeigniter?
The standard of Code Igniter is to use those three folders:
Controllers
Models
Views
You can also create sub folders to better separate your files.
Searching a bit, I found that MyClientBase use something called codeigniter-modular-extensions-hmvc that is like a extension for CI.
Modular Extensions makes the CodeIgniter PHP framework modular.
Modules are groups of independent components, typically model,
controller and view, arranged in an application modules sub-directory,
that can be dropped into other CodeIgniter applications.
HMVC stands for Hierarchical Model View Controller.
I don't have experience with hmvc so I cannot tell you what is better. For the standard CI structure, try to separate well in sub-folders (controllers, views and models) related files and try to use helpers to better reuse your code when you need to use functions in more than one place.
I think MyClientBase (which seems to be far from the "standard" exemple), seems to be using HMVC more then MVC.
I am new to Codeigniter and I am thinking about the use of this framework in my new project.
I am going to need these two extensions. Before digging into too deep, I wonder if anyone already has experience with them and can kindly give some insights on whether there is any compatibility issue when they are used together.
Modular Extensions - HMVC
http://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home
Datamapper ORM
http://datamapper.exitecms.org/
I believe there are many others who are going to use these two extensions together because they are actually very popular ones. So, many people are going to benefit from this thread.
Many many thanks to you all.
Firstly a caveat : I have used the HMVC extension but not the Datamapper ORM.
As far as I see it the two extensions have separate goals. In principle I cannot see a conflict.
The HMVC extension is useful where your view is composed of multiple sub-views. It allows you to modularise your application so that your views can be built from the output of multiple controller actions.
The Datamapper ORM allows you to map the data in your database directly onto PHP objects in your application. It saves you the cruft of writing SQL queries to pull rows from a database and hydrate objects in your application. You define what table your model is loaded from and how it is related to the other models in your application. The Datamapper generates the queries to perform the CRUD operations behind the scenes.
HMVC is concerned with how you structure your application. The Datamapper ORM is concerned with how you build your models. I don't see how the Datamapper would stop you using HMVC or vice-versa.
I'd also suggest taking a look at Doctrine ORM. It's a very powerful ORM framework that I've been using for the past year or so in all my CodeIgniter projects and works really well without any compatibility issues or such.
Tutorial for installing Doctrine with CodeIgniter.
in yii i could have mvc components (acts like an own application). could i have this too in codeigniter?
eg. in SYSTEM/APPLICATION have a folder called COMPONENTS and in there i put stand-alone applications that would be a part of the application. components like ADDRESS BOOK, MAIL, TWITTER and so on. every component folder has folders like: models, views, controllers, config etc.
so a component model extends the application model which in turn extends system's (code igniter) model. the same goes for view and controller.
i've already got a lot of these components which i want to use in codeigniter. is it good idea to place them as i said in SYSTEM/APPLICATION/COMPONENTS or is there best practice for this?
You can do this in CodeIgniter using v1.7.2 or 2.0, but using Packages as Billiam suggested would not work and sadly he is just confusing you.
You are basically looking for a HMVC architecture and this can be provided with a system called Modular Separation.
That works with CodeIgniter 1.7.2 and I have patched it to work with the (still unfinished) CodeIgniter 2.0 branch on the link in the entry.
Not by default in CI 1.7.2, but 'packages' will be available in 2.0.
Added ability to set "Package" paths -
specific paths where the Loader and
Config classes should try to look
first for a requested file. This
allows distribution of
sub-applications with their own
libraries, models, config files, etc.
in a single "package" directory. See
the Loader
class documentation for more
details.
From: http://bitbucket.org/ellislab/codeigniter/src/tip/user_guide/changelog.html
Also, take a look at Modular Extensions - HMVC