Use or not to use a PHP Framework on your new projects? Here I’ll talk about my personal opinion about that and I wish help you.
First, I have a simple concept about languages and respectives frameworks: a framework must make the development simpler. Every software has a single purpose: work! This is the main goal of every project, do that to simplify the life of someone.
Talking about PHP, it is a very simple language. It was projected to be simple and fast. If you want a language complicated or filled of dependencies, PHP is not your best choice.
PHP has the power to do a lot of things in a single line, so, if your framework of choice do the same thing in 3 or 4 lines, use the native PHP way. But you’ll ask me your framework do the same job but much better, using OO, or with beautiful code. Remember you must do the thing and make your project work. Of course the OO programming is the recommended way and you must use it, to make you like easier.
What I want to say is you should use the simpler way, to make the development faster and better. Choose a framework that help you to do the job faster, and use PHP for that. Exists some frameworks that you must learn another language almost. For me a framework must be easy to learn and with minutes you will be developing using it and make money.
I have some experience in Ruby on Rails and the reason a lot of PHP programmers moved to RoR is because it is simple, just that. You write code as you talk, but you can do the same thing using PHP, hitting the right framework for you. If you feel better using architetures like Java, take a look at Zend Framework. If you want something newer, 100% OO but easier than Zend, use Symfony 2. If you are a Rails fan and want something more directly you can go with Laravel Framework or CakePHP.
I really like the Ruby on Rails way, this is why I use Laravel for developing. It is a very good framework where you can do what you want. You can learn it fast and just reading the docs. You can go with Laravel creating a simple API or developing a complex application.
Why you must create 3 or 4 classes to get only your active users? It must be simple, like Laravel and its Eloquent ORM:
User::where('status', '=', 'active')->get(); // all active users User::find(2)->status; // get the status of user_id 2
You only have to read the code and you know what it’s doing. The code tell you everything you want, like talking. You want to render a view or use it as a mail message body:
$viewContent = View::make('users.welcome')->with('name', 'Grossi'); // just that
The new Laravel 4 is composer based, as Zend Framework 2 and Symfony 2 are. So, if you want use its components you can use composer for that. I use a lot of ZF components inside Laravel and they work well.
Resuming, you should use a PHP Framework to improve your development, but if you can do the same thing in pure PHP, do that, because you’re developing with PHP and not the framework language.
I’m a Zend Framework developer too and every project is different. But, take a look in Laravel framework, and give it a try. It is a very good project developed by a fantastic team and with some very known developers like Taylor Otwell and Dayle Rees.
I wish help you. Thanks.
64 thoughts on “Why you should use a PHP Framework and why I’m using Laravel”
Excellent blog. This is very informative to know why Laravel is the best PHP framework for developing a website.
Awesome article! I also found this article to be helpful as well: https://www.devradius.com/blog/post/why-you-should-use-the-laravel-web-framework
hey, thanks for the feedback! and the URL you sent seems very handful too. thank you for sharing and welcome to the blog!
i myself rather code in an original way , PHP pure rocks 🙂
I strongly agree. there are cases and cases! 😉 welcome!
I want to make a review website where some of the functions like user profile, enlisted businesses panel and a good data management system in backend will be like tripadvisor or yelp. So which framework will be the best for my website. One more thing my plan is to make it more flexible in design, functionality and scalability.
Hi @Sazid. Thanks for the comment. If you’re familiar with PHP I recommend Laravel. It’s easy to start with and you can start doing things very fast, but, for that, you have to know PHP well. Laravel is built using recent PHP features, so you have to understand them to understand how the framework works. JG
Hello grossi. Thanks a ton for your fast reply. Is it possible if i use laravel as framework and use WordPress as cms by integrating for site like my plan?
Will be there any pro if i do this?
Suggest me a well organized admin panel or cns to integrate with laravel framework which has SEO friendly option like rich snippets, meta description and meta tag options for optimizing my contents.
Hey @Sazid. Actually this would be a faster development process, because you’d use WP panel, which is great and allows you to create post types and custom fields in a very fast way (use for example the ACF plugin). And in the Laravel side you’d have a great application, with OOP, etc. I think you’re in the right path. JG
Thanks a to Grossi.
Will be there any problem if i use laravel as framework and use wordpress as cms by integrating these 2 things together for my project?
If not can you suggest me a user friendly cms or admin panel for laravel site which provides the SEO friendly functions like rich snippet, Meta Description. URL +Image Optimizer, Meta Tags and SEO performance checker?
Waiting for your reply.
No, no problem 😉
That’s nice post… Let’s jump to start Learning Laravel PHP Framework From Basics Scratch Guidelines Free
What do you, experts, think about the better way to start programming in PHP? I am a beginner in it, although I have a background of several years in others languagens. I had some experience with WordPress. That is a excelent tool, but my sensation is that is made for non programmers. The main idea is to simplify the process of creation. This simplification has a cost: some lost of flexibility. Am I expected to find in Laravel the same problem, or, if I want, I can do some customizations and create my own PHP functions with easyness?
Another question: Is it simple to install Laravel in a HostGator account?
Starting programming PHP is easy, not hard. PHP has changed a lot the last years, so a lot of things changed. I suggest you to start from http://phptherightway.com, where you can find the last tips from the community. It’s the better place to start programming with PHP.
WordPress is a excellent tool for creating websites, but not designed to develop web apps or API’s. For that I suggest Laravel, that is an awesome framework with a very short learning curve.
Installing Laravel in shared hosts like HostGator is possible, but it’s better to run it using a VPS for example. Today VPS servers and shared host is almost the same price. Check out http://digitalocean.com e you can get VPS servers from $5/month, with 512MB RAM. Instructions how to install Laravel (4 or 5) using a shared host you can find on my blog, in the link http://blog.jgrossi.com/201….
Any question just ask. Best regards.
Thank you junior!
I have already started learning Laravel. I can now make some simple pages. I´m still using Hostgator. It´s not now a problem for me, because I have much more to learn before taking a higher level of complexity.
Hi Roberto! Any question just ask. BTW we’re both Brazilians 🙂
Would you still use Laravel in 2015 rather than Symfony?
It seems to me that Laravel has big maintaining problems, it’s updated too frequently and each new release breaks the code written with the old release.
Although Laravel uses some Symfony components they are very different frameworks. Both philosophies are very different, so you can choose whats it’s better to you.
Laravel is like a Ruby on Rails for PHP with a bunch of components already configured and ready to use.
Thanks for the comment.
As a developer that uses both actively (Laravel when the employer forces me to and Symfony when I am free) Go with Symfony 2. The stability is amazing, 3 years old code can be moved from version 2.3 to 2.8 without a single break. They give a lot of time with deprecation notices before actually removing functions. The code structure has not changes in like 9 years and it works so beautifully… It also scales so well as it grows and has support for a lot of things such as multiple languages, soft deletes etc… etc…
Hi @Joe, thanks for the comment. I have to take a deeper look in Symfony. I’ve worked with it some time ago but not at the moment. Thanks for sharing your experiences. Best regards.
And I am not saying Laravel is bad. It is everything you described. Definitely better than no framework and better than code igniter. But Symfony is that next step up.
Sure 😉 I’ll give it a try soon. Many thanks.
Big fan of Laravel. Seems to be the best framework to me. Wins the comparison…… I’m not a techie personally, so I had to search around to hire a laravel developer and found http://www.laravelgroup.com Can anyone recommend them or any other good laravel developer or a development team, say 3-4 developers?
Hi @Nick! First, thanks for the comment. Laravel developers are in the all parts, but there is a project called LaraMap where you can see Laravel developers around you or in any place of the world. Please check https://laramap.com. Thanks for sharing.
First of all thankyou for the amazing article.
Its the year 2014, and i have been using laravel for about 1 year now.
And people were asking me to use RoR for my next project.
Problem is, i do like PHP very much, i find it comfortable to use.
Could you tell me if Laravel still stands out as a great framework in the near future?
Or would it be wise to switch RoR because of more gem support?
First of all both frameworks have their particularities and both have a great future.
I personally have experience in both but I strongly prefer PHP with Laravel. I like the way RoR works and Laravel brings some of the great thinks of RoR to the PHP world.
The Laravel staff (mainly Taylor) is doing a very god job, and his dedication to the framework is growing each more.
So, if you like PHP and like Laravel stay with them. You’re making difference too 🙂
RoR is your best bet. There is no guarantee Laravel isn’t going to be obsolete in a few years like most of the frameworks.
you’Re anglish suxxx. LOOOOL omfggg.
Nah, just kidding. I don’t see anything wrong with your English. I’m not a native though, so I might as well wrong.
Thanks anyway for this blog, I appreciate it :).
Thank you! Welcome to the blog!
Cos laravel 4 have so many files, about 5000 files… 🙂
Yes, but you don’t have to use all of them right?
I loved your article but I am in dilemma for what to use whether it is Laravel or Yii…I know its personal choice but why I should use Laravel over Yii..Also I have used customised MVC frameworks in which I have used MySQL queries directly but in this frameworks they use PDO instead.So how can I use MySQL query in this frameworks.
Sure you can use sql with frameworks. For Laravel for example you can use DB::query(“select * from table”).
About frameworks you are right. It’s a personal choice and even Laravel or Yii both are very good ones.
Thank you for the comment.
Hi, Grossi.. your article is nice. I am a student trying to learn a php framework. Lately, I am learning the laravel 4 but I stop because I want to learn a framework that helps me to land a job easily in Web Development. So, I decided to learn Symfony2. Is it a good idea? Does symfony2 is a good framework for beginner and good for employment? Thank you again for your article.
Thank you for the comment. I think you must learn PHP before to understand how things work.
About Symfony it’s a excellent framework but not for beginners. I think you can go with Laravel or even Code Igniter.
Please add a subscribe via email option. 😉
Thank you for the comment. It is good to know the post was helpful to you. I really will take a look about email subscribe.
Thanks for your detail justification for using frameworks. However, I think that advanced programming these days (I am in my 50s – gone through Fortran, Pascal, PL/1, C, C++, Java, etc.) has become the art of making simple things complex. I did take a look at some of the frameworks’ functionalities and I think that most people will end up using about 10% of it, if they are lucky.
I think that if your programming fundamentals are solid, all you need is a good code editor (auto completion, syntax highlighting and built-in debugger, if possible). If you understand good project management and have a team that will follow your policies and a good versioning system (e.g. SVN or whatever), using a framework is really very unproductive. Of course, project policies, must be well documented and adhered to.
Unfortunately, most coders these days have superficial knowledge and just tend to look for tools to generate code rather than taking the time to understand fundamentals. Most PhP programmers I have come across have no idea about object-oriented design, patterns, etc. They are heavy into syntax and features of the language. For such coders, frameworks are good. They can use them like machines to generate code without understanding the code itself.
I liked your comments, therefore decided to respond with a long answer. We can agree to disagree and leave it there -:)
On a different note, Brazil is one place I have always wanted to visit. Hope some day I can be there. Been to many countries in the west and am back in India now.
I have programmed for years and then went into something totally unrelated and after a gap of 6 years am back into it! I did a lot of C and C++ development. I looked at PhP and I wonder why would anyone use a framework if your fundamental knowledge in computing is solid?
I mean, if you know OO, RDBMS, Security protocols, Internet protocols, etc. in depth, why bother to learn a “framework” because it needs one more subject to be learned and if your work needs to be maintained, the next developer needs to know one more area – the framework.
PhP is fairly high-level so why burden it with one more level of abstraction? Framework also restrict your flexibility in coding. Right?
Please comment on this. And yes, thanks for some interesting feedback on your blog.
First thanks for the comment. I really like this type of comments. And at the same time I agree and disagree with you. Let’s see:
PHP is a ready to use language. You can create wonderful things with it, “alone”. If you know very good OO, Design Patterns, etc, you can do a lot with pure PHP, but you will have to create your own library/components, to reuse, to make your life easier and make more money 😀
A long time ago I created my own bunch of classes; to connect do the database, to work with HTML, etc, but when I started with Code Igniter Framework in 2007 I saw that every classe I wrote, Code Igniter was wrote better, but why? Because contribution. I know I could developed my own classes much better than I wrote, but time is a very serious problem. With Code Igniter, the objetive was the framework, not my app. So the people behind the framework wrote very good code, and I saw that was the moment to start to use it. After CI I started with Zend Framework I, in 2008. I was in love with it. VERY VERY VERY well wrote, patterns and more. So I started to learn with it, look the code and study it.
I think you are right. After the “Composer” era, the “reuse” of code is much better. You can use a Form generator provided by one X developer, you can use too the Database ORM provided by another developer and you can use components from frameworks too. If you are developing a small website you maybe don’t need a full stack framework, but you can install a ORM using composer. Why do you have to create your own ORM if you can use the fantastic Eloquent ORM (Laravel)? Just include it inside your Composer and be happy. But if the project is easy you can use PDO and write your own SQL query, why not? You don’t have to learn a framework. You have to understand it. You don’t have to use all components, just what you need.
After Composer and FIG-standards I think a lot of things changed. If I’m starting a small project I’ll start with Slim Framework (I love its routes system), with Eloquent ORM, and Respect Validation (or not), and maybe more. But if I’m starting a medium project I’ll choose Laravel, because I’ll have everything (well developed) in one place, together.
Use a framework or not is your choice, but you have to reuse code, just it. I can create a full website using WordPress, with administration area, in 2 or 3 hours. But I cannot create the same website at the same time writing everything, even using a framework. We have tools for everything, but we have to know when use each one.
I think I wrote a lot! Sorry :D. But it’s a very particular choice and maybe we can write a book about it.
Thanks again for the comment.
I agree. http://programming-motherfu…
Simple Answer: Why learn PHP when you can build a website in C? Because PHP makes it easier.
User::where(‘status’, ‘=’, ‘active’)->get();
Without a PHP framework would involve
– getting a database instance
– writing SQL
– Reading database resultset into an array
Which could easily go past 10 lines of code. Problems:
– More code to write and debug
– More possibility of bugs
– Longer development time
Think of a good framework as an investment that pays off in the future.
Same or more time would be taken by installing VMs, setting up env. No point in comparing lines when the whole experience is slowed down.
I am developing a website with core php and mysql. Reading your article I am into a little bit confusion. Can’t we make a secure website with core php i mean not using any kind of framework (cake php or zend)
Of course you can! Not only with PHP but every time you are developing something you have to beware with security issues. PHP is a very easy language to start with so you have always concern with that.
The frameworks was developed with these problems in mind, so even you are using a framework or not you have always to look for security problems, like SQL injection, XSS attack, etc. You can use a framework and write a bad code, with security problems. This is not a framework problem but a developer problem.
I strongly recommend a framework because of code reuse. With frameworks you can’t concern with common problems and how to solve them, the framework generally has the solution, in a very interesting way. Generally frameworks use a lot of OO and Design Patterns, so it is a very good opportunity to improve your coding knowledges with them, and be a better coder.
Thanks a lot for the comment and if you have another question you can contact me by email too, or twitter, or here, in the blog.
Thanks for the article Grossi, you shed some light on this matter as I’m also starting with ROR while i’ve been using php for 3 years mainly in CMS type of extensions . I’ll definitely look in to Laravel .
I’m a big fan of RoR too. I’ve used it for 3 years and I love the Ruby syntax, but PHP is my passion and I think Laravel and Composer give me an “up” to continue to code in PHP.
Thanks for the comment and I’m happy the post helped you.
What is your opinion about codeigniter framework?
I was a Code Igniter user for 2 years, around 2007 and 2008. It is a very good framework and I think it has the best community I’ve ever seen.
But at the same time I think developers must improve the code techniques every day, so I’m aways looking for better use of OO and Design Patterns, thinks you can find easily with frameworks like Zend and Symfony. With these frameworks you must use some patterns and is a good opportunity to understand them.
But Code Igniter is a very good framework!
Thanks again for the comment!
nice blog bro! :highfive:
Hi Nico! Thanks for the comment! And welcome to the blog! s
Zend, symfony , cake… And why not yiiframework ?
Thanks for the comment. I’ve already used Yii Framework sometimes and it’s a very good framework. I think framework you have to love to use. It’s a very personal choice. Yii is a very good framework, and Laravel, Zend too.
You are awesome bro…
Thanks man! Really thanks!
i dont care about your english language speaking I care about your knowledge especially laravel 😉
Thank you Tendai. It’s very good read that =). Regards.
Do not apologize for your English. You are learning. If anyone has a problem with it then they should find another blog.
Roderick, thank you for the comment. And it’s a pleasure to have you visiting my blog. Thanks!
Excellent article..but which framework is the fastest to learn for rapid app development?laravel/cakephp?
Hi Ritwik! Thanks for the comment.
Both frameworks use some Ruby On Rails ideas, what is good (my opinion). I think Laravel is more updated about PHP worlds, like the use of Composer, using good Design Patterns, etc. I strong you start with Laravel. It is easy to learn and is a VERY powerful framework.
We’ve seen frameworks/platforms come and go over the past decade: http://www.christofcoetzee….
Your post is amazing, very good, really! Framework is about choices. As you can see I’ve used Zend Framework 1 as main framework for years. I have some interesting blog posts about it. Laravel is my framework now because I like it, I like its features, but this is a personal choice.
I don’t like ZF2, but I like Symfony. It depends of the project you’re developing and remember, your application is not child of a framework 😀
Thanks for the contribution and congrats for the blog post.