Is CodeIgniter a wise choice for large applications? - php

I keep on reading how great codeigniter is from a development standpoint. And I am sure that using the framework will make the development process quicker. But the question I ask myself is, will there be a difference to a individually made framework, which caters to your needs?
Is CI, despite the advertised small footprint, going to "bog" down the system because it is basically a framework on a framework (the later referring to PHP as framework of C)? Are there good ways to spread the load? Are there any large applications in the wild that have been made with CI?
Thanks
Casper.

I'm running a codeigniter site with about 11K files.
I've heavily modified the codeigniter's basic structure for my needs. For instance, I have 3 applications with 3 front controllers using the same system files. I'm using smarty as my templating engine. I have rich PHP web apps powered by jquery and prototype/Scriptaculous. I use form validation, authentication, active record, emailing, etc. etc.
My experience so far has been very positive.
Once you get a (real) templating engine like smarty plugged into Codeigniter you have all the power that you'll need for medium to large sites.
You have to think about organizing your site into large 'metagroups' as the 'controller' structure in Codeigniter expects such behavior. ('blogs', 'merchandise', 'forums', etc..)
CI is very easy to add plugins for.
The framework simplifies a lot of crap you would otherwise need to hand code. It's fast, simple and configurable.
My one big complaint with CI so far is that it's not very multi-application aware. The default layout assumes you're running 1 application. In my case, I have a global application with the global file that can be pulled into all running applications. However, this could be solved more elegantly. Additionally, you have to add a little extra fluff to switch between front controllers.
My favorite aspect of CI is easy of active record on a MySQL DB. It's dead simple to set up a DB connection and get active record queries running.
I would say that it's pretty easy to get started with. Just make sure you shop around and figure out how to plug smarty into your app. You CAN use the default 'view's of Codeigniter, but the minute you need if/else logic in your templates you're screwed.
I set up a 'templates' and a 'content' area in each app that I can fill with smarty templates and static content respectively. The rest I can pull from a DB connection.

This really is a question that only you can answer. When you speak of a "large system", you could mean something largely used (by pageviews / etc.), or something that encompasses a huge set of business rules but used only by a few people. Does the application need to be fast, or can you load balance it across multiple servers?
Your "PHP is a framework on C" comment is fairly out of whack, IMO. No, PHP isn't as fast as C. But it's a LOT better at handling web requests. PHP is used in some of the biggest sites in the world -- Facebook was originally written entirely in PHP. Yahoo uses PHP quite a bit. So PHP is fast enough for just about anybody, especially considering that the database will almost always be your bottleneck. If your PHP applications are slowing, you can use memcache / load balancers / put more application servers on your network. Pretty easy to scale the PHP end of stuff.
What I can tell you is a brief comparison with other frameworks. I've used CI in limited deployments, mostly helping out other people, but what I have seen, I've liked. It gives you a speed-in-runtime advantage over something like CakePHP, but it will increase your development time (as Cake's biggest strength is its ability to rapidly develop and deploy). Speed-wise it feels pretty comparable to Zend or Symfony, which is still about 5-7x slower than just writing the raw PHP yourself.
To sum the various frameworks (NB: my opinion below):
CakePHP is great for rapid development. Its performance is the worst of the major frameworks, although the 1.3 release (coming soon!) is supposed to get you a free (no changes in the API, they're just removing the PHP4 support) 25% speed boost. It's focused on ActiveRecord, and is super fast to get a full featured site up and running (seriously, seriously Rapid Development / Prototyping chops).
Zend is the most widely used. It has the most flexibility with its adding modules. It's super fast, although not particularly lightweight. For an enterprise project, I'd go with this one or symfony. Feels like using a buncha different libraries to me. And their naming conventions are a little onerous...
Symfony - see the Zend comments. Although symfony is supposed to be even more enterprisey.
CodeIgnitor is the new hot kid on the block. Its focused on staying out of your way while still being a "framework", i.e. a tool that will help you do your job faster. It's fast to run, but a little slower to develop.

Related

Pure PHP CMS or Laravel based CMS for web application development

I am setting my own software development company and I have to choose how to organize our work. We will have to develop website and web applications in general in the near future and I would like t organize the workflow in the way we don't loose more time then needed on development process.
My concern regarding the above, is to take one of the tons of PHP existing CMS out there and use it as a base for all the coming projects or take a Laravel CMS such as OctoberCMS, or similar and use it as a base project. The former gives me more choice, because there are many CMSs with a lot of modules and templates ready to use, the latter would be a great base either for small websites and also for more complex web applications, being Laraval a MVC framework it is ready for developing more complex web applications, but offers less functionality and modules (for example OctoberCMS provides a not very easy CMS tool for editing pages, which would be not suitable for my customers).
I would like to hear your suggestions and thoughts.
Thank you
I kinda had the same trouble months ago, and I ended up choosing the framework option.
After months developing and using Wordpress-based solutions for my clients I noticed that the start up of every single project was very fast (easy to install, lots of materials available for free or cheap) and enough satisfactory, but the hell arrived every time there were some more-than-little modifications (logics and design).
Using a framework with a pattern like MVC (I use Yii) may be more difficult at the beginning, but write, debug, and organize your code is far more fluid and satisfactory, on the long run. Even a module (cms) can be easily extended or rewrite with lesser effort than packed CMS solutions like Wordpress.
So, summing up: upvote for framework option.
I made the decision to switch from WordPress being my defacto platform for new projects when Laravel Framework v4 was released, much for the same reasons mentioned by #SomethingWicked. I also have a fundamental issue with Matt M. and WordPress Core development team, that WordPress is an Application Platform. It is not, it is a Content Management Platform. Purely because it takes too many liberties in making assumptions (biased to blogging and content management) for the user.
I am also a firm believer in the 12-Factor App (http://12factor.net), which WordPress makes very difficult, neigh impossible, to adhere to.

Is there an MVC PHP framework designed for an packaged product?

The "Framework" question has been asked a bunch of times here but having read everything I can find, I can't find the answer to this question.
I'm creating everything from games, to CMS's, social applications, etc. I've used Zend and CodeUgnighter briefly, but when I deliver it, its going to have a bunch of unnecessary folders and it requires anyone who wants to modify my program to know the framework, and they've got a mountain to move if they want to update it to the latest version of the framework.
It just seems to me that frameworks were designed mostly for super large projects where its being designed for one customer, not a released program. It seems like all the big packaged php products out there make their own frameworks (vbulletin, etc).
its going to have a bunch of unnecessary folders
These uncessary folders are stored in one folder and are needed for the framework to work, is that the 10, 20, 200 Mb which is problem? Storage is cheap nowadays, why cares?
it requires anyone who wants to modify
my program to know the framework
You got it! It is an advantage, not an inconvenient. If it doesn't, the guy which will read your code will need to understand your habits, your convention, and they probably are not so common.
If you are able to write consistent code, following any conventions, why not.
But it can also gives your customer a real plus value since he knows that anyone could take back your work if you have to leave for any reasons.
they've got a mountain to move if they want to update it to the latest version of the framework.
In any case upgrading a framework, an application to a new version is most of the time a moutain since in a production environment, you need to test, and test again, to be sure your application is stable.
Most of the framework give releases notes which should let you know about backward compatibility.
It just seems to me that frameworks
were designed mostly for super large
projects.
Zend or Code Igniter fit well for medium sized project, with time you developed framework extensions and you'll be able to save time and bugs on smaller project.
It seems like all the big packaged php
products out there make their own
frameworks (vbulletin, etc).
PHP framework are youngs, most of them are 3/4 years old (Zend, Symfony). A lot of application like Vbulletin are older.
There a lot application based on common framework, but they don't target the same people.
Joomla, Drupal, Wordpress have their own framework (procedural, or object) but they target more the end-user.
However a solution like Magento, which uses Zend Framework, is designed to be extended and very customizable with extensions.
There are many light-weight PHP MVC frameworks, each with varying degrees of features and flexibility. The majority of these are going to be lacking advanced features, but will get the job done.
One that comes to mind is: http://www.kissmvc.com.
Hope that helps :)
You're right that most frameworks are tailored towards 'one size fits it all', meaning they have a lot of stuff that you won't necessarily need on every project. Which sometimes makes them a bit heavyweight. More 'modern' frameworks DO have a strong focus on modularization, but when it comes to the core there are often a lot of inter-dependencies.
One solution: Roll your own framework, dissect code from other frameworks and use parts you like/need. If you can, lean more towards using libraries that focus on specific tasks that you need. E.g. ORM for databases, you might as well use doctrine since it's area of expertise is very focused. Just as an example.
Either way, if you do it right it's a lot of work upfront trying to figure out what you even need. Start with the basics, how do your controllers work, do you need the full implementation of MVC with front controllers, action controllers, maybe page controllers for a CMS? Where can you cut corners, where not? It really depends a lot on what YOU need for your specific product (or product palette).
The other solution, like Serge mentioned, is getting a lightweight framework which really just focuses on the basics. And fill all the holes yourself, or by using 3rd party libraries where they are available.
I personally use a heavily modified version of FLOW3 (currently in alpha development) which uses a lot of cool stuff, but lacks a bit when it comes to using legacy databases (they have their own domain model implementation). Which is what I changed mostly for my version.

Django or Drupal, which one should I use that suits best my needs?

I want to learn and use Drupal or Django for the following:
dynamic web sites, medium database, multi-level users, paypal integration, content managment, speed (developing), security
I like MVC, ORM and object-oriented prg.
Which is better to jump into ? Which one is more mature, powerful, understandable, object-oriented and easier to use by the time ?
What about Python Spring ...
Also, which of these 3 are better documented, are better for a cv and have more extensions?
Known languages: php, java, mysql
Thank you !
I've built several sites on Drupal and Django, my conclusion is: if you need to create something similar to the standard drupal (or Ubercart) feature-set, you don't have much time for development, and you don't expect hight load pressure on a site - you should pick Drupal.
But if you do need to create something more or less custom (no drupal modules already available) you should go with Django - it is quicker and more pleasurable to implement custom complex features using Django. For example if my goal is to implement a second stackoverflow, I'll prefer Django because it will be extremely complicated to implement this badge-based rating system with Drupal.
P.S.
Studying Python (and Django) is an investment in your future, I think. You'll never be able to implement something similar to DropBox using drupal and php, although it could be implemented with java - but java is not so good from development speed perspective.
I'm primarily a (happy) Drupal developer these days, but a friend whose dev skills surpass mine has switched happily from Drupal to Django. Here's his set of reasons.
Drupal and Django doesn't make for a good comparison, as they are quite different.
If all you need is a simple website with a CMS and Paypal, I would go for Drupal. Drupal's strength compared Django is it's many modules (modular system), which most of the time can get you where you want. Drupal is also extremely flexible, and you can change almost anything from within your own code, and there is a huge demand for Drupal developers. You can also let site builders create content, display content and much from from within the AI.
Django on the other hand, is more simple and structured. It's based a lot more on code, making it fast and easy to develop something, but hard for non coders to change certain things. For sites that require a lot of custom coding, I usually prefer working with Django. Python is also a more structured programming language than PHP (IMO), and it's easier to make more maintainable code.
Jump into what you like or what attracts you most after getting a little overview of the capabilities and constraints. I never worked with drupal, but I can recommend django.
Consider your deployment. Pretty much every host will support Drupal. If you go with Django, you will need to select a host that supports fast_cgi or wsgi
You already know php, so just for that you might want to stick with Drupal. However, I prefer Django over Drupal for many reasons.
http://www.reddit.com/r/django/comments/bhvhz/the_onion_uses_django_and_why_it_matters_to_us/ provides some excellent background.
Basically if want things done properly with lots of flexibility, go with Django. If you're very familiar with php, don't feel like learning python, and your site requirements are basic, go with Drupal.
Something to keep in mind is that Django is a bona fide web framework, whereas Drupal is more of a web platform. That is, sometimes you have to hack Drupal to get what you want or that it doesn't fit all situations.
I had never heard of Spring Python but based on the fact that their own site is powered by Drupal, I wouldn't recommend it. Especially if you know Java already, why not consider the original Spring platform?
I've been developing with Django for more than 2 years and have built a couple of Drupal sites in the meantime (per client's specific request to use Drupal). My conclusions are the following:
Even for a smaller site I would have done it quicker building it from scratch with django (or maybe even PHP) for a simple reason, writing code for me is faster than hunting through drupal's unorganized mess of menus and options, or hunting on the web for a module that implements hack X to enable feature Y.
Migrating a site from development to production with Drupal is a big PITA. You can forget about using a VCS tool. All your work is in in the MySQL dump (including configurations, programming logic, views etc.), a few hacked up modules and the uploaded files.

Do PHP Frameworks speed up the development process?

I recently started working for a web firm as a freelancer, taking my hobby of coding in PHP to a career level, and since then I have been overwhelmed by the amount of work that needs to be done within short time frames.
The problem isn’t being able to do what is asked, but being able to do it all as quickly as is needed of me. I never used any PHP frameworks, but if I started using one, would that speed up the entire development process? If so, how drastically?
Also which framework would be best for my purpose?
If it matters, what I do is mostly build back end CMSs and tie that in with front end functionality for small business client sites.
Once you know a Framework well (i.e. don't have to spend time learning how to use it), yes, it helps speed up both :
The development process
The maintenance process
Why ? Well, probably, at least, because :
It provides guidelines
No need to think (too much) about what goes where, or how to do X or Y
Those guidelines are known by everyone who knows the framework -- which means you can hire a guy that knows the framework, and he'll need less time to be efficient on your project
It provides a lot of useful libraries
which means less time spent re-inventing the wheel
and components that are already integrated in/with the framework ; which makes it easier to use them from your application than some random external component
Now, for the "which framework should I use" part... it's mostly a matter of personnal preferences, and there are many existing questions about that on SO.
To only give you a few links, you can start taking a look at questions+answers such as :
PHP Framework Decision - Analysis paralysis!
What PHP framework would you choose for a new application and why?
To use a PHP framework or not?
PHP - MVC framework?
Which PHP Framework is right for this project?
Best PHP framework for an experienced PHP developer?
And there are many others -- you can use the search box, in the upper-right corner of the site, to find more ;-)
They certainly do.
Something to be aware of is there are variable learning curves depending on the framework that you decide upon. So you might experience slower development initially while getting comfortable in a new environment.
I have seen the zend framework recommended may times.
firstly if you go to phpframeworks you can view exactly what kind of framework would fit your work load.
next, frameworks initially take time to implement corectly, but once everything is done, it speeds up considerably your development time for your projects. However what's nice about this is that if your framework is done correctly you can apply it to all your projects. Where I work currently we have a framework that is implemented and it applies to all the sites that are being developed. if you want each project to have the same type of look and feel and functionality then a framework is your best bet
however if it's just for one project it might be a little too much.

PHP CMS with independent framework

We currently use MySource Matrix CMS for large projects, Wordpress CMS for small projects and Zend Framework for bespoke applications...
I'm not trying to confuse and compare a CMS to a framework, that has been done before :-)
I want to identify a few CMSs for review that have foundations in strong (preferably independent) PHP frameworks.
The only one I have looked at is SilverStripe CMS and Sapphire Framework.
We have many clients that have a CMS for internet and/ or extranet and then various other bespoke applications that are then integrated via various means to look like they're in the CMS.
I believe it will be more productive and beneficial to have a common framework between these branches so they can be natively merged.
Hope this makes sense.
PS. I have used custom assets in MySource Matrix and specific modules in other CMS but you feel you are working for the CMS not the application you are building.
Have you looked at Expression Engine? Its built on top of the CodeIgniter MVC framework, and may provide a lot of flexibility for having parts of the site be managed content, and branching out into more application type stuff using CI when needed. Not free, but all my colleagues that use it, swear by it (so much so that I'll actually consider it for the next project that fits this profile). There are also add-ons for many of the commons problems you're likely to want to solve.
And while not PHP, the Django framework is also a nice cross between CMS and App Framework, with some really great features like DB Migrations, etc. I can honestly say that Learning Python made me a better PHP Programmer, and the projects I've done with django were fun and fast to code. Not to start a holy war, but I describe Django as Drupal without all the clutter (and yes I've worked with Drupal enough to respect and fear it at the same time ~ too much friction in the Drupal dev process for my taste).
Even if I didn't get clearly what you are looking for I was just searching for a CMS that is not bundled with a propietary PHP framework and it should also be fast, simple coded, ordered and flexible to extend.
After a lot of search I found OctoberCMS. It uses Laravel PHP framework and it's intended for wevdevelopers/programmers, may be in a future it will also support more WYSIWYG edition. Right now it's very fast and easy to extend via MVC implementations or plugins.
It has a nice code and structure to work as programmer. If you like to create content via HTML+CSS and you don't care about WYSIWYG, then this could be a great alternative.
It's a very different approach compared to other CMS bundles. I'm not saying it's better, just different.
With their slogans:
The PHP framework for web artisans
http://laravel.com
The platform that gets back to basics
https://octobercms.com
Have you tried Drupal? We have used it as a CMS and also integrated it with things like Microsoft Dynamics and UPS Worldship. It's pretty flexible like that.
I wouldn't call sapphire and independent framework for the simple fact you'll have a hard time finding many apps written in sapphire alone - sapphire pretty much is silverstripe. Theres also the issues of silverstripe using an ajax powered admin interface for much of its own functionality meaning you have to adhere to these to keep the same look and feel with the bespoke work you want to add.

Categories