5 ms·
Ask HN: I program in pure PHP - Should I be doing something different?
I graduated from a state university with a degree in Marketing, but I started programming as a junior in high school. Besides a few high school courses, I have no formal training and program for the web in php with no frameworks (except jquery for javscript/ajax functions).
I see a lot of rapid development discussion and I like cranking out relatively simple websites quickly, but I think I am limited by the programming techniques I am using. For example, I programmed (isWearing.com and SmarterFootball.com), and I used a lot of the similar features into a prototype I made this past week (foodmarkit.com). All three sites are relatively uncomplicated (mostly database driven), but it took a long time to recreate the same basic processes. I'm assuming "there's gotta be a better way". So... what is out there?
I've heard a lot about django, ruby on rails, pythong etc... What do you think is the best option for me and rapid development?
- kls 16y agobut it took a long time to recreate the same basic processes. Are you using Drupal? if you are doing a lot of the same boiler plate it may be because you are not using a CMS that will allow you to reuse components across sites. Something like Drupal may help you to make your UI components more reusable while still allowing you to use PHP.
- cosmok 16y agoWelcome to the world of web development! You are going to be recreating a lot of stuff (especially if you are going to be working for a corporation). I have a little experience with using djano but, I do most of my work in PHP. I have started to like Zend Framework(ZF) and I would recommend that to you as you already know PHP (instead of learning django, ror, etc.). ZF should speed up your development a bit. These days, I mostly prefer doing Sys Admin stuff and playing with Javascript and I shudder at creating a web app from scratch. When I am not working for money, I do not force myself to create a web app. But, when I do start working on something I tend to work extremely hard.
- pwim 16y agoYou might try CakePHP (http://cakephp.org/ http://cakephp.org/), the rails inspired framework.
- ddemchuk 16y agoCODEIGNITER I use a variety of languages and frameworks, and CodeIgniter is the closest to what you described you're used to with some great boiler plate code. I've done everything from simple one off CMS apps to very robust multi site automated apps, all in Codeigniter. Check it out, it's easy to get started with, you don't need the command line, there's no magic. Just helpful code.
- kishorenc 16y agoI really recommend Codeigniter also. It's awesome and will be right within your comfort zone. The documentation is also really good.
- BerislavLopac 16y agoDjango. It'll change your life.
- rubinelli 16y agoI think Django is extremely powerful, the way it lets you cleanly integrate entire pre-built features adding two or three lines is amazing, but understanding this is my own experience and doesn't reflect the general case, I found it daunting at first. My perception is that it is aimed at the large, full-featured, content-rich website, not the over-the-weekend one-trick-pony project you are more likely to start when you are still learning.
- growt 16y agoIf you want to stay with PHP (which is not a bad choice, contrary to what you might hear from the hip crowd) you might want to try symfony. It's just one of many PHP MVC Frameworks, but I think its one of the better ones.
- ytNumbers 16y agoYou should take a look at the Yii framework. http://www.yiiframework.com/ http://www.yiiframework.com/
- mgkimsal 16y agoThe best option would be to pick a framework and learn to use it. I may get flamed for this view, but I don't really think it matters as much which framework you choose, just choose one and learn to use it well. Invest time in to learning with it on a throwaway project. You will not be as productive end-to-end on day 1 as you are with your current tools - that's OK, because after learning a framework, you will be more productive than pure hand-coding for any web-app of any complexity. You'll likely be safer, because there's been more effort put in to most frameworks to help protect against web attacks (SQL injection in most cases). Learning a framework will teach you to think differently about your development process, as well as introduce you to a community of like-minded developers all using the same tool. It will help you develop a development process. You'll get to the point where you're comfortable and productive, and then you'll start noticing limitations in whatever framework you're using. That's the time to start looking for another one, and either jumping over to using that, or more ideally, looking at what ideas and components you can reincorporate in to your current tech stack. I love Grails (Java) because, while it's niche, it makes model-drive development a snap. I create classes, identify relationships, and the system can generate the db layer (tables, etc) for me automatically. There are ways to do some of this in PHP, but the language itself makes this extremely verbose. However... I still use PHP (now using zfkit as a basis) for some projects, and have done some .Net work where it made sense (on an MS-only project, to be precise). It's easier to jump around now because I've spent time understanding not just the particular languages involved, but thinking about how web apps are commonly abstracted (MVC, service layers, db layers, etc). Understanding those common patterns makes it easier to swap between frameworks and platforms as needed. Gentle plug - I'm working on a starter kit for zend framework - zfkit.com - which aims to bring a somewhat better 'out of the box' experience to ZF (at least from my perspective). You can download and it's bundled and preconfigured to use the Doctrine ORM tool. That said, if ZF and Doctrine rather make you say "huh?" it may not be for you just yet. :)
- viktorino 16y agoThere are a lot of PHP based frameworks along you want to deal with the verbosity of the PHP language. Two types of frameworks : "Full stack" and "glue" "Full Stack" are more automated and 'easy' to start and create CRUD. "Glue" are more powerful, full of libraries but less automated and a learning curve more demanding. Full Stack - Cakephp - Symfony - Kohana - CodeIgniter Glue - Pear - Zend Framework The two extremes are Cake and Zend Framework If you want to stay with PHP try Kohana. If not, Rails (Ruby) or Django (Python) are the best out there. I recommend you to stop deciding and start doing something with one of these.
- amk 16y agoIf you are new to MVC frameworks, you can get started very quickly with Codeigniter or Kohona. Otherwise, it's really worth investing some time learning Symfony or cakephp. Another way to go would be to learn a ORM (doctrine) and a templating engine (tinybutstrong or smarty). I have never done any big php project without the help of frameworks, but some of my work friends find this approach (templating engine + ORM) more easier and better. I can't agree with them, though. Frameworks are not all about rapid development. If used properly, they structure your application and make it easier for maintain.
- kishorenc 16y agoSince you are already comfortable somewhat with PHP, I suggest you take it in and work on it for a while till you understand the life cycle of a web application. I highly recommend Codeigniter framework - it does a lot of heavy lifting for you. Taking this route will also help you realise what you like and don't like about PHP. THEN, you will be in a better position to judge if something like django or ruby on rails would suite you better.
- botondpeter 16y agoMy first post here. I am not a full-time-webdeveloper. Catalyst framework, Mason and TT templating works quiet well for me even with existing static site rewrites. The templating also helps me manage many other text files,like invoices. For a CRUD the external database can reuse the nicely generated Schema and Model classes. catalyst is written in perl and parts of it in c. I also used php4, django, pylons, and zope and find catalyst the lesser problem when moving from webservers to webservers, version to version, config to config etc.
- metachris 16y agoTry web.py [1]. It's a lightweight python framework for developing web apps. I personally like the Jinja templating engine [2] in conjunction. You will love it, and I bet you'll enjoy python! :) [1] http://webpy.org/ http://webpy.org/ [2] http://pypi.python.org/pypi/Jinja2 http://pypi.python.org/pypi/Jinja2
- Yaa101 16y agoThe problems I have with frameworks are bloat and that they force you to work in the way that the creator of the framework has visioned, if you find a framework that fits you than you should consider yourself lucky and in that case you'd better use it to your advantage. I advice you to stick with PHP for web development opposed to other languages, in itself it would not matter which language you use, but PHP has always been focused on web programming and has resolved most underlying problems dealing with that web programming, I personally also find it one of the most productive languages not much different from C in the compiled world. I think the best option is to slowly create your own framework (PHP Classes) so it fits your way of thinking and problem solving best.
- stiggz 16y agoLearn CodeIgniter or CakePHP, you'll be amazed at how quickly the sites come together after a couple months of learning, esp. when you're building from scratch. A site that took me two months in vanilla php can take 2 weeks in codeigniter. However, retrofitting a site that someone else made with those frameworks can be a frustrating experience, as everyone has their own quirks when learning frameworks. Retrofitting vanilla php couldn't be easier if it tried.