I want to learn framework in php- laravel or codeignitor

i want to learn framework in php. But I’m confused from where to start… laravel or codeignitor ? they both are different framework but which one is better ?

Be aware lot of the answers you will get to this question will be based on personal experience and opinion (hopefully backed up with some solid information) because it all depends on what you want to use the framework for.

Laravel is an excellent framework and is rapidly becoming very popular. CodeIgniter is a lighter-weight framework and is probably easier to learn quickly to the level where you are ready to build an application with it. Both frameworks come with good community backing and lots of courses and tutorials and documentation.

1 Like

Learn Laravel.

CI has been in a stagnation for almost a decade and although now trying to catch up, there is no reason to catch the train that is out of schedule.

1 Like

Maybe you should have checked the Wiki article about CodeIgniter before posting :wink:

History
The first public version of CodeIgniter was released by EllisLab on February 28, 2006.[12]

On July 9, 2013, EllisLab announced that it was seeking a new owner for CodeIgniter, citing a lack of resources to give the framework the attention they felt it deserved.[13] On October 6, 2014, EllisLab announced that CodeIgniter would continue development under the stewardship of the British Columbia Institute of Technology.[14]

This is what I call “trying to catch up after a decade of stagnation” exactly.

The way I interpret the Wiki article is that the “stagnation” period was from July 9, 2013 to October 6, 2014 which is a long way short of ten years :slight_smile:

As far as catching up is concerned then Laravel was introduced for the following reasons:

Taylor Otwell created Laravel as an attempt to provide a more advanced alternative to the CodeIgniter framework,which did not provide certain features such as built-in support for user authentication and authorization.

CodeIgniter’s popularity is due to being lean, mean and extremely fast. As far as “user authentication and authorization” not being included, many developers such as myself do not require those features. If on the off-chance circumstances change then there are numerous libraries available.

Laravel is enormous compared with CodeIgniter because it has so many features which are not required by many developers.

Oh. I see.
Well you need to read between the lines here. As you can imagine, such things do not happen all of sudden - you have a state of art product that works well, but one morning you get up and decide to give it away. Of course such a decision was taken after years of stagnation.

CI was in a decline for so many years that desperate users started with new forks like Kohana and FuelPHP, (which were superior to CI but now all dead in turn already).

I can understand old users clutching to CI as they know it already. But tell a newcomer to learn a an outdated technology is a strange suggestion.

Laravel is enormous compared with CodeIgniter because it has so many features which are not required by many developers.

It looks more like an excuse for the PHP users’ habitual laziness and fear for new technologies.

Laravel is way too complicated to learn a PHP Framework and far better to learn a simple version. Once mastered it is relatively easy to learn another framework.

I have tried Laravel, YUI, Kohana, and FuelPHP and still prefer CodeIgniter.

[ot]I have also tried Golang which I found to be far too complicated for my needs :slight_smile:
[/ot]

Raw PHP with all its while ($row = mysql_fetch_array($result)) echo “”.$row[‘name’].“”; is superior to CI in simplicity. Go suggest it instead

CI used to have an Acive Record Class which has now been upgraded to Query Builder…

$this->db->select('*')->from('my_table')
        ->group_start()
                ->where('a', 'a')
                ->or_group_start()
                        ->where('b', 'b')
                        ->where('c', 'c')
                ->group_end()
        ->group_end()
        ->where('d', 'd')
->get();

// Generates:
// SELECT * FROM (`my_table`) 
// WHERE ( `a` = 'a' 
// OR ( `b` = 'b' 
// AND `c` = 'c' ) ) 
// AND `d` = 'd'

…which made my upgrade from MySQL to MySQLi and PDO a very simple task with a one line change to select the latest database.

I prefer wrapping the SQL statements in a function and passing the search, update, delete, range, etc parameters. DRY principle but it is good to know how to use the Php MySQL statements.

I don’t want to sound rude (though often I do, I regret that).
But really, the question here is not your personal preferences.

There is an obvious difference between a modern and an outdated approach.
Ok, now CI got a query builder. But how many tutorials you can find telling you how to use it? None, I guess. While there is a lot of outdated tutorials suggested by Google due to their age.
In a way, all this modern stuff is alien to CI while fluent for Laravel. And there are a lot of other examples.
I am far from selling Laravel to you personally, but I think there is no question what to learn for a newcomer.

After all, is there anything for CI even near to https://laracasts.com ?

1 Like

CI has excellent documentation with many examples and it is hard to find any better tutorials.

https://www.codeigniter.com/user_guide/database/index.html

Edit:

I forgot to mention that I find video tutorials much harder to follow than web-page tutorials. So much easier to copy and paste examples and to return to a previous pointl

1 Like

I personally use CodeIgniter 3 for the simple reason that it is very lightweight and quick I have tried Laravel and a few others (latest Symfony for example) but keep coming back to CI tied in with Ion Auth for Access control I also try to employ best coding practices where possible, the codeigniter documentation has a good style guide to help you with this, also codeigniter seems to scale well for larger projects and doesn’t restrict you to doing things their way, if there is something codeigniter cannot do I can usually create my own functions to achieve the desired result, this is my personal opinion I am sure other PHP developers may have their own preferred frameworks or even create their own.

2 Likes

Laravel has a lighter framework without every bell and whistle called Lumen. If you ever need more, it can easily be swapped with the full sized framework and still function.

I don’t buy the “CI is dead” opinion, but I do think it operates in the “old” way of doing things. Old doesn’t mean bad, but the code is not ultra modern. It’s not Composer, it’s not autoloads, it has its own style guide, there aren’t use statements everywhere and namespaces. If anything it does come across as simpler, and easier to understand.

CI defaults to an “older” URI routing pattern of example.com/controller/method/arg1/arg2. But Laravel has you define routes using pattern matching. I always thought the controller/method/arg style of routing was easy to understand and faster to use. It’s how I set up routing whenever I worked in pure PHP (no frameworks) because it’s easy to create a routing function that handles the URL in one way only. No manually defined route patterns.

The list could go on. But I would generally say, both are good. And further, CI should feel easier to use, easier to understand, easier to get started. But Laravel owns the “I’m newer and more popular and you aren’t cool if you can’t use me” status. CI feels like older coding patterns. Laravel is all the latest methodologies.

Laravel is surrounded by a whole lot of tooling, education resources, command line functionality, automations, etc. There is a lot to learn and the more you know, probably the better it gets.

If I had to get a project done in short order and didn’t know either framework very well, I’d go with CI. But if I want to learn “the latest” and be a cool kid and really become a wizard at one framework, I would spend my time on Laravel.

4 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.