0

Hello,

I wonder which is more efficient to create a complex software CRM system like salesforce.com:

To use frameworks(CI) or to program using OOP PHP ?

7
Contributors
7
Replies
54
Views
4 Years
Discussion Span
Last Post by Banderson
1

Well, any (good) PHP framework that you would use that is current will most likely be all OOP. If you are trying to get up and started building an application, I would recommend getting started with a framework.

If you are trying to learn and you are not concerned about time then you could try writing your own framework. But writing your own really isn't ideal in my opinion, and it would just be re-inventing the wheel unless you have a really good reason to not use an existing framework. Daniweb uses codeigniter for the forums. I just started recently playing with Laravel which looks really awesome so far.

3

Learn the basics of OOP first, otherwise the framework won't make much sense - especially when you come to writing your own stuff.

CI is a very loose with regard to MVC - the model being 'optional' almost, but it's easy to pick up. CakePHP, similarly is quite straightforward. Yii gained a lot of attention a couple of years ago, but has been eclipsed somewhat by Laravel in the attention stakes since then. All of them have their pros and cons, supporters and detractors. Try a few of them - but beware, all have learning curves, the steepness of which may depend upon your experience with OOP.

Some frameworks are probably best left alone until you get a nosebleed repair kit. Yes, I'm looking at you Symfony!

Edited by diafol

0

If you are new to OOP, there is a framework called kohana. OOP is pretty dry in this framework, you will not get wet that for sure, and most importantly NO NOSE BLEEDS that never stops like the one I have :). You can probably use this framework in about an hour or two after learning its basic construct , as long as you can write a simple function($foo){ return $bar; }, should be enough for you to start experimenting with Kohana "framework". As your knowledge in OOP progresses, you can then attemp to use the ORM, Sprig, and Jelly Object modeling.

Again, a problem for good documentation is always hard to find. The developers always assumed we always know something.

For beginners in framewoking, Kohana is a good training ground, because you don't really need to write many codes to make it work. One unique characteristic of Kohana, is that you can create a database query for a particular table and at the same time, name the model file after that table. For example if we are to send a SELECT query for the table 'phonebook', the model file can be called phonebook.php, and amazingly the model class can also be named phonebook.

Filename: model/phonebook.php

<?php defined('SYSPATH') OR die('No direct access allowed.');

class Model_phonebook extends ORM {

 function get_number(){
      $result = DB::query(Database::SELECT, 'SELECT name,number FROM phonebook ORDER By id DESC LIMIT 0, 15')->execute();

      return $result;

      }
}

Interestingly enough, the controller is bind capable..again if we are to write a controller for our phonebook application above, the controller is as simple as this

Filename: controller/phonebook.php

<?php defined('SYSPATH') or die('No direct script access.');

    class Controller_Phonebook extends Controller {


    public function action_index()
    {

   $phonebook = Model::factory('phonebook')->get_number();
    $thisview = View::factory('test/phonebook')
                              ->bind('result', $phonebook);
     $this->response->body($thisview);                         

  }

} 

The view file is called phonebook.php, it can be changed to whatever you like, but the model has to stay as phonebook.

Filename: view/phonebook.php

<?php defined('SYSPATH') or die('No direct script access.'); ?>

<h1>Veedeoo Coding Kohana</h1>

 <ul>
<?php

foreach($result as $item){
    echo '<li>'. $item['name'].' : '. $item['number'] .'</li>';
}

?>
</ul>

In less than 20 lines of codes , we created a simple phonebook apps. We can even attempt to integrate the Smarty or twig, by passing the output to the smarty and let the smarty render the template output. Very similar to CI/Smarty integration. Or a second option is to let the view take the instance of the smarty object and then assign the template into a separate template directory.

NEWS!

The current owner of CI , Ellis Lab is seeking new owner for CI. It has been a while since the last upgrade, and they have no plan of doing so. They want to dump it, so let's forget about CI3. Maybe the next 2 years the older CI will not be able to cope with the fast changing PHP. Most importantly the way the PHP handles session.

0

I don't think I know how to create my own MVC framework using OOP PHP yet. I only know how to create php classes and use them. I don't know if that's good enough.

I also, just started learning the OOP. Well, other framework besides CI does not have a good documentation yet I think (very rare in my country). CI is more famous and has a lot of documentation. I am still beginner in CI - never really use it for real programming.

I don't know, I have a simple web project comming up. I simply have to create a simple CMS for text and picture. I might use CI for this one. And normal OOP for another one (more complex one). From there I can compare which one is more efficient, before I started programing a complex ERP applications.

Edited by davy_yg

0

I was in your same situation. It was hard to pick in which way to go, but after I tried to do everything from scratch, I realized how much code I had to write, so I felt that I really should use a framework which have everything built to me (MVC structure, Libraries, Helpers etc...). There are many free frameworks available online. CI is really powerful, and has the best guide and many free tutorials. Here's a graph that compares the google search for many known frameworks.
http://www.google.com/trends/explore#q=zend%20framework%2C%20%20codeigniter%2C%20%20symfony%2C%20%20yii%2C%20%20kohana&cmpt=q

Edited by cmps

0

I've attempted creating my own PHP MVC type framework called IceTray. I haven't worked on it in ages but you can take a look at the source but some of my design and code descisions may be questionable but it works fine for me. And I do agree writing a mini framework is a huge learning experience.

0

You want complex eh? Use Laravel. Laravel is OOP and why reinvent the wheel?

I like a touch of craft in my applications this is why I always use objects and not arrays.

Edited by Banderson

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.