Is it possible to get codeigniter to work with a different framework?
the situation is as follows.
my client (who is also a programmer) asks me to develop an address book (with mysql database) with a lot of functionality. then it can interact with some of the class methods that I provide it. kind of API.
the situation is that the address book application is getting bigger and bigger and I feel like it is better to use CodeIgniter to code it with MVC.
I wonder if I can use codeigniter and then somehow give it access to the controller methods.
eg. the controller has some functions that can be called using a web browser.
public function create_contact($information) {..}
public function delete_contact($id) {..}
public function get_contact($id) {..}
however, they are simply called from the web browser. how can i let my client access these functions like API?
then in his own application he can use:
$result = $address_book->create_contact($information);
if($result) {
echo "Success";
}
$contact = $address_book->get_contact($id);
this way my control methods handle inputs and outputs using models. there will be no views because I just need to return data / result from models. and he can just use my "API" functions.
Is it possible?
I just know how to access controller methods using a web browser. and I think it is not an option for it to use the title (location) to access them.
all suggestions are welcome to make this possible! even other approaches allowing me to use CI for development. maybe there are already good practices for such collaboration between frameworks?
thanks
a source to share
MVC seems to have figured it out in its definition. This definition that I will propose should be perfect for you.
Models are where you create your business end of the application. Operations such as create_contact, delete_contact, and get_contact are specific to the model layer. The model layer is what builds the application API and should be completely independent.
Consider controllers solely as user puppeteers. Controllers take user input - validation, sanitation, and whatever else can be done elsewhere - and calls the API you already installed at the model level. In addition, the controllers then determine which view to use - no matter how complex and simple your presentation layer is.
The presentation layer is usually not a difficulty. As long as you only use read operations on the view, you should be fine.
To clarify, if the user wants to create a new contact, the controller might need a create_contact method that accepts the appropriate input. However, the actual contact creation operation must be done on the model layer. This will allow another developer to reuse the same operation in a completely different application by loading your model, which has already been designed as an independent entity.
a source to share