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.
Related
So I'm about to start a big Property Management System for the cloud. This Hotel system already exists in VB.net technologies, and now we are porting the whole system to web.
We are trying to decide between ASP.net or PHP, we are thinking on PHP because ASP.net would cost too much on licensing and servers. So there is Laravel, Symphony, CodeIgniter, Zend, etc..
The thing is, this project is suppose to live for years to come. But we feel like getting constraint ed by using a PHP framework, because every time the framework gets updated then we need to update our whole system. For example.. now Laravel got updated from version 4 to 5. And the whole folder structure changed. I can't imagine having our big system needing to be updated and keep up to every Laravel version update. How do you keep up with this ?
Also, what would happened if Laravel disappears, its the trendy fashion now. But we see PHP frameworks come and go.
Would it be wiser not to use any php framework and building everything from scratch to have more control over it ?
You should first note that using a framework is primarily meant to solve two issues;
Force coding into a certain 'format'. Collaboratively working on code can generate 'hacked' solutions, or unmaintainable code. A framework can be the force which helps keep these things in check.
A framework comes with a certain core-code which handles for example database abstraction, routing, etc. which can save you a lot of time to develop yourself.
An extra thing to mention; when implementing new features, there is the possibility someone has built it before and maybe even better than you would have anticipated.
Keeping up with the framework should not be too hard, as long as you abide by the coding guidelines of the framework. With the bigger frameworks, new releases have (or after sometime generate) tutorials on how to port your previous version into the new version format.
Choosing which framework to use, is a question which is opinion-based and not suited to discuss here, but keep in mind that you choose your framework according to your needs. Also check how big the community is and how much 3rd party plugins/code exists (the more, the longer the framework will last).
Good luck!
You could see a framework as a base to start from. Remember that you get all the code! Look at the code. Do you like it? Does it fit your requirements? Using a framework gives you a huge advantage over making everything yourself from scratch.
But do you need to update? Would you update your own code constantly? Perhaps it's not always needed. Sure, if there is a security issue you should do something about it, but seeing every update to a framework as essential is just plain nonsense.
I build projects aimed at specific versions of frameworks and libraries. I try to build in flexibility so I can swap out frameworks and libraries, and versions, but I often find that I stick with what's working.
Some people might not like this, and argue you should always be on the latest version, but I find that completely impractical.
I already have v1 of my webapp written in Codeigniter/PHP.
I'm now working on v2, which will have some significant changes to all MVC components.
I'm pretty comfortable with CI and I like it. Very intuitive for a C coder like me.
But I am wondering if it is worth it to rewrite the app in Rails?
Will the productivity gains be worth the cost of learning another framework from scratch?
I want to be practical and not chase something just because it's cooler or more fun.
Here are some productivity criteria:
HTML and CSS generation is fairly labor intensive. Does Rails have anything distinctive to help with this?
I'd like to reuse other people's code for commonly implemented functionality (e.g. interfacing with FB, Twitter, and other social sites). How much more 3rd party code reuse would I get with Rails?
How much more benefit would I get from the Rails community vs. CI community?
Make automated testing easier. I test manually today, which is labor-intensive.
I'd appreciate specific benefits vs. idealistic/religious arguments.
Thanks!
Codeigniter is obviously a framework built on PHP. While there are fundamental differences between PHP and Ruby, all of your criteria can be met with either of the two languages. Migrating to Ruby would seem to be a waste of time considering your requirements. There are plenty of ways to automate HTML/CSS in PHP and there are numerous open source Facebook/Twitter integrations (just check FB and Twitter developer sections). There are also plenty of open source PHP testing options available. Google is your friend! IMO it would be a big waste of time to rewrite your entire application for the sake of your criteria when there are plenty of PHP solutions to your problem.
I think the better comparison here would be CI to Symfony. Symfony 1.4 is a PHP framework pretty much on par with Rails functionality - as far as I can tell through my research, anyway (I'm not a Ruby programmer).
If you were to switch to to Symfony, you would gain a lot of productivity tools. Symfony 1.4 + Doctrine has the ability to generate a lot of your code/interface for you. Symfony/Doctrine likes to keep you away from repetitive tasks such as building models and data validation.
If you want to do your research ahead of time, I suggest reading through Symfony's free e-book Piratical Symfony to give you an idea of how things work in Symfony.
Now, with all that said I feel obliged to mention that the Symfony team is working on Symfony 2.0 which will not be backwards compatible with Symfony 1.4. The expected release date is March of 2011. I expect that maintenance on Symfony 1.4 will continue in the future.
-- Edit --
I also think that sticking with your native language would allow you to develop with the least amount of overhead. Changing to a new language means having to learn it's up's and downs in order to be truly productive.
IE to be at a point where you're not coming back in 6 months to fix a bug that an experienced Ruby developer would have known to avoid.
To me, this is more a question of how big your current web app is. If it took you a couple of weekends and you do not have a tight deadline, I would switch to Ruby/Rails.
However, if it's significantly large and you actually want to come up with R2 in a timely fashion, I would suggest sticking with PHP.
As to your specific questions, I'm not too familiar with PHP, but I don't think Rails will give you a whole lot more in the HTML/CSS department. Not sure about the next two bullet points. Ruby does have much better automated testing tools, with new stuff coming out all the time.
Here are a couple links about Derek Sivers, who switched from PHP to Rails to PHP and now likes Rails again. It might help your thinking.
http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html
http://railstutorial.org/ruby-on-rails-tutorial-book#foreword
I'm building this web site for my friend's startup. The site when its complete should be able to handle 10,000 users at a time and should have great security.
I've been developing the site individually till now and everything seems to be pretty feasible, but some of my developer friends suggest that i move to a framework.
What are the pros and cons of moving to a framework?
Also i have developed a pretty big part of the website till now, so can i just move it into a framework environment. I've never worked on any kind of framework before.
Cons of going to a framework:
a learning curve
you may have to approach things differently then you would normally
performance overhead (probably slight)
Pros (of a GOOD framework):
much of the mundane coding is already done
helps you write clear, compartmentalized code
libraries included to help you with security, database communication, etc
easier for other developers to jump into the project
bug fixes from the framework's community
The number one benefit of moving to a framework is that the people who developed the framework already solved (most of) the problems you would face if you would do everything yourself. I think this argument should be enough to answer your question.
If you need help in choosing a framework, stackoverflow has lots of already answered questions in this area. You should take a look at some of the opinions already posted and decide what you need.
Why do you want to invent the wheel over and over again? Building your own system is, in my opinion, only usefull if you want to learn how to build such a system and get familiair with the basics of a CMS. The problem with it is that you have to do all the debugging yourself which will take ages. With a framework, other people already did that work for you, so you can make progress much faster.
There is no thing like a best framework. I have worked with Zend Framework and Kohana 3. Both are really nice frameworks but if it was up to me I would take Kohana. Remember there are many more frameworks and this is not a complete comparison. Just give it a google and choose the one you feel most comfortable with.
Good luck!
I would suggest the Zend Framework as per your requirement.Just look at site view futures,but it some what difficult to learn in start.But if you want customization then Core php is the best.For security you have to know the things some better way like sql injection & design the architecture according to it.For faster development you can also move to ROR.
Have Dream Day
Further to my comments, I find working with other peoples frameworks rather a procrustean endeavour. Because I wrote it, I know my framework inside out and can rattle code off very quickly whereas when I am coding for a popular framework like CodeIgniter, Zend or Symfony it takes me that little bit longer to remember how I'm supposed to do something in the way they want me to.
Of course, a lot of the hurdles, common tasks and security issues will have been encountered and solved for you if you use a framework. However, if you've already written a large part of the website code then refactoring it to leverage a framework could be quite a substantial undertaking unless you've been quite clever with your initial architecture and have things loosely coupled.
I have a simple site to develop and would like to learn PHP as I go. I want the site to be secure, scalable, and easy to maintain. Should I learn a framework and PHP simultaneously? If I build off of a framework there will be lots of unfamiliar code in play. Would you say this increases security risks?
There's nothing about using a framework that will impede you learning PHP, and using an established framework will reduce the security risk, as you'll be dealing with well tested code for handling common tasks.
At the core of most of the PHP frameworks in play these days is this simple three step workflow
The URL is requested and routed through a central bootstrap index.php file
The URL name is used to derive a classname and a method name (and action method). This is your main entry point and where you start writing PHP to handle the request
At the end of this method, control is handed over to a view template, which has access to certain values you set in step two.
Pick a framework, learn how it does the above, and then write any kind of PHP you want in the action method and the view template.
Yes, there will be a lot of other PHP framework code in play, but you never have to look at it.
Yes, the framework will have a multitude of features and/or a "preferred" way for handling things, but you only need to use those you instantly understand.
When you start noticing patterns of ugly, boring, or insecure code, take a look at the framework features again. More often than not after "doing it wrong" you'll get insights as to why the framework code did something in a particular way and you'll be happy to hand off the responsibility (I'd say ActiveRecord style models vs. SQL code is a big one here)
As you start using the objet oriented systems the framework provides you'll start to get interested in how they're doing certain things, and then you can start poking at the core framework code.
Absolutely. Frameworks will do all the boilerplate code for you, providing you a higher level of abstraction. It will probably be easier for you to code without dealing with some of PHP's idiosyncrasies.
Any half decent framework will also address security issues, so if you are new to the language, chances are your app written on the framework will be safer than the one you write from scratch.
I wouldn't recommend starting with a framework to beginning developers. If you've got a lot of experience with other OOP languages, there shouldn't be a problem. But you should at least know the basics (syntax e.g.) before even thinking about using frameworks.
I would say it depends on your prior experience. It's not so much PHP itself, but the web server environment it lives in that can be distracting. If you're already familiar with the HTTP request lifecycle and have written web applications in a similar stateless fashion as you do with PHP, you shouldn't have a big problem jumping right into using a framework.
If you come from a "stateful" background or no background at all though, the abstractions a framework offers can become a problem. You should at least know how to handle sessions, cookies, headers, $_POST and the like in plain PHP before having the details abstracted away from you by a framework. Also see this previous answer of mine.
I think minimising the amount of custom code you are writing is probably a good thing if you are not confident in your ability to create secure systems (particularly for things like authentication). As a result, I think using a web framework in this way would be to your advantage. It will also allow you to familiarise yourself with the core of the langauge without worrying about peripheral concerns.
I have seen a few people (with a big previous OOP knowledge) to learn PHP and symfony simultaneously without difficulties.
In fact, moving from PHP from an object oriented language is just learn a few conceptual things and the syntax and API of PHP itself.
In my opinion, there's nothing wrong with learning a framework at the same time as you are learning a language. There are already a fair amount of situations where this is the case by necessity. For example, most people learning Objective-C learn the Cocoa frameworks at the same time, most C# programmers will learn .Net along with it, even the JDK should be considered a framework which you learn along with the Java language. And for what it's worth, I learned the Symfony framework with very little PHP experience beforehand.
I would advice you to start with PHP turorial on w3schools.com. It is short and clear. You can learn all the necessary basics in one-two hours. In order to understand any framework you will need that. Then study the first and the second chapter from CakePHP cookbook and create your first CakePHP applications using their tutorials. On the rest I agree with Alan Storm.
Getting started with a framework in PHP, also depends on the fact whether you have some prior programming experience and if yes, what kind of.
If you have muddled in some other programming languages like java, c, learning a php framework simultaneously while creating your website might not be too difficult.
Almost all of the PHP frameworks you will encounter use the MVC design pattern - if you understand the basics of MVC, if you have implemented or have gist of design patterns in other programming languages, then it will be quite easy starting with PHP frameworks.
Also your choice of PHP framework will be the deciding factor. If you employ PHP frameworks like Codeigniter, Yii, maybe even CakePHP which have comparatively smaller learning curves, you will find your path wellpaved for you in PHP. Although if choose some framework like Symfony, Zend - you might get frustrated in taking too much time in doing simple things, in turn blowing up your project.
As for the part about security risk, all of the frameworks I mentioned above and some others I have not mentioned, have spent enough time on the stage to have squashed the security risks.
Hope this helps in deciding.
Although I'm a fan of frameworks, I agree with some of the other comments above. Starting with a framework can be pretty confusing, especially if you're not experienced in the theory of Model View Controller (MVC) object oriented programming (OOP).
Truth be told, I've seen a lot more unfinished framework projects in my day than apps built without a framework. If your application is written with some clunky PHP and the application takes off, then you can hire the necessary resources to move to a framework and get it developed to withstand a lot of usage and utilize resources effectively.
My advice would be to master PHP first, then move to frameworks. My last note on this, many frameworks have flaws as well - so depending on your application needs, applying the wrong framework could drive it into the ground.
Just my 2 cents as a guy that has released a couple of enterprise apps successfully - without using a PHP framework.
I have been dabbling in programming/scripting languages since I was a kid. I started off with HTML and CSS, then went on to PHP (which I got quite good at) and then to Python, Perl, and C(++). I've recently done a lot of work in PHP (along with MySQL).
After spending so much time learning these languages, I now want to do something with them. I'm looking at starting/contributing to an open source project; almost certainly a web application of some sort.
In my experience with writing (admittedly small) web applications, I've found writing "pure" PHP to be an extremely slow and tedious process.
My question is this: if I were to be writing a relatively complex/large web application from scratch, what should I write it in? Should I use pure PHP/MySQL, or use a framework like Django, Rails, or CakePHP?
Writing a complex application from scratch, I would definitly not use "bare PHP" : I would certainly use a framework : they provide :
a large number of useful classes/methods
some set of rules -- like "in which directory should controllers be saved", "how to write a view", ...
MVC -- i.e. they help with better structuration of the project
Note that this answer is valid for both personnal projects, and professionnal projects.
There are several great Frameworks in PHP, like :
Zend Framework
Symfony
CakePHP
Code Igniter
Kohana
One thing to remember : learning how to use a framework well will take some time : starting with a small project, before going for a big one, would probably be a good idea ;-)
Now, when you're asking yourself the question of "which framework should I choose", it's mostly a matter of personnal preferences... And here are a couple of questions/answers that might help a bit :
PHP Framework Decision - Analysis paralysis!
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?
As you're asking me which Framework I would choose ; well :
I really like Zend Framework, and often use Doctrine as ORM (it's the default ORM of Symfony, but can be used very easily with ZF)
If I had to choose another one, I would probably go with Symfony, as I've seen it used on a couple of projects at work, and know many people who work with it and like it
If you already know that language, you should most definitely use a framework (unless you're a masochist).
For me, besides that fact that they're usually bundled with all sorts of great libraries, using a framework is all about using time effectively.
Most importantly, it will save you time. You're freed from the nitty-gritty of worrying about the foundation/architecture and are able to spend your time of the features of the application itself.
Also, it will save others time; especially since you plan on being all open sourcey.
depending of your skills level, yes you can do it in pure PHP without frameworks. This also will be good, IMO, to improve your skills at debugging, logics, and others. But, on the other hand, you will restrict to other programmers to improve/maintain your code due to learning curve, in this case, the framework serves as a commom language. I recommend that if your project will be complex, or with the possiblity to other programmers join in the project, that you choose a framework which you feels comfortable and use it.
Depends on who will be working with the code, on which plattform it has to run and how complex the database should be.
If you develop for a company or community it is always easiest to use PHP because there are many others who know it so i.e. for companies it's easier to recruit someone who knows the language.
If you mostly want to develop on your own, use what you like most, i even heard of websites written in pure common lisp.
If the application can run on windows only C# is also a good solution as you can develop web applications extremely fast and the .NET library makes many tasks easy.
As database backend you can use MySQL if the structure is simple but for more complex databases i'd use postgres as the MySQL performance seems to drop fast with increasing complexity (subjective opinion).
EDIT:
As others noted, Frameworks are always a good idea. There are web frameworks for most of the current languages. For PHP CakePHP was recently recommended to me.