Slashdot Mirror


Taking the Sting Out of PHP 5 Programming

bfioca writes "Where are the all-in-one PHP frameworks that make building well-factored and maintainable applications as easy as building simple sites? O'Reilly ONLamp's recent article Simplify PHP Development with WASP shows how to make a simple database-backed site with WASP in just a few lines of code. Other PHP 5 frameworks such as symfony and PRADO have been getting a lot of recent attention as well."

30 of 159 comments (clear)

  1. Drupal? by rjung2k · · Score: 3, Informative

    I don't claim to be a web architecture guru, but what's wrong with Drupal? Open source, PHP 5-friendly, and does everything from vanity sites to corporate sites.

    1. Re:Drupal? by albalbo · · Score: 3, Interesting

      I think you have to hack it to get it to work multisite? Also, the URLs are pretty horrible.

      That's not to say stuff like PRADO is any good either - I used it for a commercial site, and it's a pain to maintain. It's an ASP-style component system, and doesn't fit the web model - if you want to do 'Ajax', for example, you're screwed.

      symfony looks interesting, though, and much more lightweight.

      --
      "Elmo knows where you live!" - The Simpsons
    2. Re:Drupal? by carndearg · · Score: 2, Informative

      Drupal is a content management framework, these are application frameworks. In other words Drupal is the application and once you've installed it and whatever modules you need all you have to do is input your content while an application framework requires you to use it to write an application before you can think of content. Drupal is very useful if you want to do what it or one of its modules already does but it is less flexible for custom applications.

    3. Re:Drupal? by slashdotnickname · · Score: 2, Interesting

      We actually tested out Drupal for possibly doing a customer's portal site last year. It had a lot of features and was quick to set up, but it was a nightmare to customize it beyond anything simple. I think it's a great product for non-techies to get something up with, but it's too restrictive for any complex business logic needs.

    4. Re:Drupal? by WebCrapper · · Score: 2, Interesting

      Couldn't agree more.

      In the long run, I would rather write my own CMS than use someone elses. When I first learned PHP, I wrote my own system. Now that I'm older and less stupid, I realize how many security holes where in the application, but in the 3 years I used it, not one hiccup because it wasn't documented anywhere.

      I messed around with Mambo (sorta, kinda, like Drupal) and really didn't like it. I hacked it a little to do what I wanted, but found it wasn't for me.

      At the same time, I'm a little at a loss. I'm currently writting an OSS application and while I know there will be security flaws, I'm stuck on what I want to do with the data. Do I encrypt everything, have the option of a global storage DB (my DB, not the one people install the application on), etc... Too many choices and they could all, somehow, become a security issue.

    5. Re:Drupal? by rdean400 · · Score: 2, Insightful

      I looked at the symfony site. Once I got to the HTML templates with embedded PHP, I closed the window. If I want to combine code with HTML, I'll use JSP or ASP - the component model and syntax are cleaner.

    6. Re:Drupal? by truthsearch · · Score: 3, Informative

      No, it takes no hacking to work multisite. I'm running 3 sites on one code base right now. The URLs are very short. There's nothing horrible about them. And if you turn on the right module you can automatically link to /title/page+title. Learn about an app before complaining about it.

    7. Re:Drupal? by truthsearch · · Score: 2, Interesting

      If you want to do anything beyond things that relate directly to content management then Drupal's not a great option. In theory you could strip out most of the module and use it as an app framework, but you won't get gaining too much over writing your own foundation. Drupal is mostly specific to CMS needs.

    8. Re:Drupal? by kbahey · · Score: 2, Informative

      You probably saw scans for the old versions of xmlrpc.

      This was a third party library that we incorporated in Drupal a while back to do some remote stuff (e.g. remote blogging, ...etc.)

      If you do not use third party client apps to post, you can delete the file xmplrpc.php altogether if you wish.

      When it was discovered that it has security flaws, we replaced it completely.

      Newer versions are as secure as they can be.

    9. Re:Drupal? by kbahey · · Score: 4, Informative
      Disclaimer: I am a Drupal community member and developer.

      I think you have to hack it to get it to work multisite?


      Nope.

      Drupal has multi site out of the box, and has been like that for years. For some 18 months, I ran 4 different domain out of the same code base and the same database even (with database prefixes).

      Also, the URLs are pretty horrible.


      Drupal boasts "clean URLs" out of the box as well. This means that urls do not have to be www.example.com?q=node/123 but rather www.example.com/node/123 (this requires mod_rewrite).

      Moreover, Drupal has out of the box the path module which allows you to alias any page to any URL you like. There is also a contributed module (pathauto) that makes this totally automated.

      Check my web site for examples (all URLs are aliased).
  2. Bogus by Anonymous Coward · · Score: 4, Insightful

    Give me a break, depending on such things is terribly bad for maintainable code. Exactly the opposite of the billing given above. Will code written with it be compatible with PHP 6? How long after PHP 6's release will such tools be made compatible? If you need tools to simplify php coding, you might as well just forget it.

    If you want a quality product, there are no shortcuts. There is no such thing as a free lunch.

    A big thumbsdown on this kind of crap. "Sting" to PHP 5 programming? Get real.

    1. Re:Bogus by afd8856 · · Score: 3, Insightful

      You are either ignorant to what a real open source framework would represent (limit code reinvention, benefit from community effort, etc) or are not in the target group of such a framework (maybe you work for a big company that has a large programming team, who knows).
      Either way, I can tell you that, from my personal experience, learning and adopting a framework in your work can have a lot of benefits, for me, as a small custom business solutions provider.

      --
      I'll do the stupid thing first and then you shy people follow...
  3. I don't see the magic words MVC... by aphexddb · · Score: 4, Insightful

    JASPF (Just another silly PHP framework)

    If you are looking for quick app development and you aren't joe home user making a website you are going to need something thats based off a model -> view -> controller architecture. Symphony does this, so does the cake framework.

    --
    "We're all mad here." --Cheshire Cat
    1. Re:I don't see the magic words MVC... by Nigel182 · · Score: 2, Informative

      Quick note: WASP does use the MVC paradigm. Here's a link to the MVC portion of the sample application tutorial. http://wasp.sourceforge.net/content/?q=node/7#Mode l.2C_Views.2C_and_Controllers

  4. Re:Just use Ruby or Python by onion2k · · Score: 2, Insightful

    Currently I'd discount Ruby from any sizable web development as it's still very much a minority language and it'd be practically impossible, or outragously expensive, to hire a Ruby developer. If your development team or company vanish (run over by a bus, move to Australia, whatever) you need to be able to get someone else who can come in and maintain the code quickly. That just wouldn't happen for a site written in Ruby. Of course, it'd be fine for any small development like a homepage or a blog .. but PHP would be equally fine for such an unimportant venture despite it's shortcomings. To a lesser extent the same can be said for Python. There's a lot fewer Python developers about than PHP, but there are some.

    Caveat: IAAPD (I Am A PHP Developer), so perhaps I'm horribly biased.

  5. I should think so too. by afernie · · Score: 3, Funny

    Sting has had his finger in entirely too many pies since The Police broke up...

  6. Re:I need PHP by killjoe · · Score: 4, Insightful

    So let me get this straight. You don't know PHP, you don't want to learn PHP but you want use PHP to build some web apps. Did I get that right?

    Seems like a fools errand to me. I predict you will fail miserably and your web site will be hacked within 24 hours of you putting it up.

    You really should learn the language that you are trying to build web sites in.

    --
    evil is as evil does
  7. Re:Just use Ruby or Python by varanid · · Score: 2, Interesting

    considering the forum in posting, I wouldn't be surprised if I was modded down, buut I signed up on slashdot finally just to make this my first post as a reply

    while I agree its a niche language now, it won't be long I imagine till ruby ges more mainstream. The main thing holding ruby back so far has been a lack of books on the subject. hoowever, that is quickly changing and already ruby is more popular than python in japan.

    caveat emptor: I've only been dabbeling in ruby for the past week or so

    anyway, so far I rather like the language as it somehow manages to emain fairly concise yet readable unlike perl and as a language, I find it alot more powerful than php.

    ruby + the rails network shhouldn't be dismissed just yet and php programmers would be wise to at least devote some time to learning ruby. I don't imain, assuming you knoow OOP, anyone would have much of a problem learning ruby, and it scales much better for large apps

    note: I myself have used php extensivly in the past but I am now seriously considering going to ruby on rails as my nnew dev environment

  8. Attempts != Problem by truthsearch · · Score: 2, Insightful

    So portscans of my Macs prove there are many Mac exploits? Drupal has had just a few very specific security issues, just like any other internet-based app. There are many thousands of drupal-based sites, so evil-doers have written scripts to hunt down and take advantage of those that haven't upgraded. Nothing here uncommon to any other system. My drupal referrer logs fill with thousands to requests for IIS-specific files, yet I've never run a site on Windows.

  9. Re:I need PHP by hazah · · Score: 2, Informative

    Look, unless you are able to at least glue these components with SOME code, you aren't going to get anywhere. Just forget about it, because such an elaborate GUI does NOT exist. GUI isn't your solution either, since you don't understand the fundamentals of the problems you are trying to solve. Sorry, but you're either going to have to hit the books, or pay/convince someone else to do this for you.

  10. Re:I need PHP by Charbax · · Score: 3, Funny

    I think I understand the fundamentals, I just don't know PHP.. I can design a database, and I can understand the kind of interaction there needs to be between the tables. Imagine a GUI, first step design a database, with tables and relations. NExt step, you can define some tables as some standard ones, like "username" or "password". Then choose the actions that the PHP pages will do and include, for example the username and password box. And then define on the "logged-in" php page what can happen from which tables. Imagine such GUI that does not create every advanced PHP system, but is advanced enough to design ones own Digg.com kind of system, own search, own custom cms, members area, digital files store and lots of stuff like that. It will generate the php pages and it will be possible to view source and edit them to cutomize them..

  11. a framework is NOT a shortcut (or a CMS!) by webwright · · Score: 4, Insightful

    I tear my eyes out everytime someone calls a framework a "shortcut". Usually they follow it by "There's no substitute for good coders writing good code." The business reality is that most coders are not exceptional, and some are pretty lousy. You can spend all of your budget on human resources finding epic-quality coders (and then scratch some more to come up with their epic-salaries) or you can do what the rest of the world does-- get the best programmers they can find and afford. A framework helps un-exceptional coders write better (and more consistent/maintainable) code. This arguments seems akin to saying "forget word processors! Just get someone who can make Vi or Emacs dance and turn 'em loose." It seems to me that the evolution of software is pretty much the act of layering increasingly-smart frameworks on top of machine language to allow high quality results more accessible to more people.

  12. Re:I need PHP by Magic5Ball · · Score: 2, Informative

    Macromedia/Adobe Dreamweaver has *limited* support for what you describe (table views [kind of], forms, db updates, page layout, and maybe cookies). You still won't be able to design digg.com with zero understanding of how PHP and web apps work though, regardless of how good the tool is.

    Also, your understanding of databases and interfaces needs to be more sophisticated than building a contact manager in MS Access...

    --
    There are 1.1... kinds of people.
  13. actually, the "sting" of php5 is... by acroyear · · Score: 2, Insightful

    the fact that because of all of the php-4 compliant code that it breaks, few ISPs doing web hosting services are in any hurry to upgrade because too many customers simply don't have the time to rewrite their applications to be compliant with php-5, much less take advantage of any or all of the new features.

    this is hitting me hard as i'm trying to put together an xml-intensive app and am stuck using home-grown open-source XML parsing and generating packages, mostly unfinished, that won't be finished because they've been superseeded by the php5 libraries that i can't use yet.

    --
    "But remember, most lynch mobs aren't this nice." (H.Simpson)
    -- Joe
  14. Never ever use PHPNuke by NoSuchGuy · · Score: 2, Informative

    Bad security by default.
    Read here.

    --
    Grundgesetz * 23. Mai 1949 - 30. November 2007 - http://www.vorratsdatenspeicherung.de/
  15. Re:Just use Ruby or Python by danharan · · Score: 2, Interesting

    There are a lot more Ruby developers than Ruby jobs.

    And they tend to be better developers too, those that enjoy hacking and being productive.

    --
    Information: "I want to be anthropomorphized"
  16. Re:*Please* use Ruby or Python by Parham · · Score: 2, Informative

    This is the one point I have to agree with. PHP has great documentation (with loads of comments). I had to learn Python in school and to this day I still can't browse around the documentation properly without getting frustrated. Python is a great language, it enforces great structure and readability, but the docs for it are incredibly annoying.

  17. Re:Just use Ruby or Python by CoughDropAddict · · Score: 2, Insightful

    If your programming immune system immediately rejects any language that is more mindbending than the simple if/while/for/switch/function constructs of C-like languages, you will forever be a pretty naive programmer.

    As an example, JavaScript has OO, but no classes! How do you suppose that is? It's prototype-based OO. It's an interesting alternative to class-based OO. Well-rounded programmers can pick up a concept like that rapidly -- they don't just say "this is too much of a hassle."

    The basics in Ruby are no harder than C or PHP. Things only get more difficult when you start saying things that simply cannot be said in C or PHP.

  18. Frameworks, stygma, and rolling by eruanno · · Score: 2, Insightful

    Frameworks are fantastic beasts. I fear them yet I adore them at the same time. I do this with anything that I didn't write. Indeed, I moreso do this with anything that I do write!

    To the point: I see a lot of people bashing the concept of frameworks and stating that you shouldn't use frameworks because it's just being lazy or that frameworks are a bad thing. I believe this negativity comes from inexperience and ignorance.

    I agree, these are biting words, but consider the fact that the arguments used to support these ideas are based on incorrect assumptions and false information: thusly revealing that they know nothing about the framework(s) nor have they used them. (Either that, or they've used them incorrectly, producing a negative response! Try brushing your teeth with a hacksaw!)

    Goals of various frameworks are many, with each framework focusing on something completely different. I'll consider the framework that I am currently in the process of developing as an example: this framework's goal is to provide a semi-rigid structure for web application development, with particular emphasis on separating executive logic, data logic, and interface logic. (For anyone that doesn't know right off, this is the MVC pattern.) I chose this pattern simply because it suited how I like to develop my programs and gives me the amount of flexibility I need to provide for easy ways to quickly develop and make changes, to work with teams, and to better see how my code is interacting with the flow of the program. What happens with something doesn't work? Well, I pinpoint what type of error is ocurring, then I can cut out two-thirds of the code (granted, very little code is required for the model to actually work).

    I read a number of comments ago that PHP was designed without a rigid structure to provide for rapid development and flexibility. The commentor is absolutely correct, but it wasn't designed to disallow structure completely. In fact, with the blank canvas that PHP does provide, it certainly welcomes all attempts at structuring code. This is evident in its (newly-revamped) support for object oriented design as well as even basic support of functions.

    Another argument that I heard levied against frameworks is that they sometimes don't support certain functionality. There are two responses for this: firstly, not every solution is perfect; secondly, some frameworks are poorly designed. Of course, the second point is just that and requires no further exploration. However, the first point must be clarified. Certainly, we all agree that there are no perfect solutions, but doesn't this seem a bit like a copout? I don't believe so: I believe that limitations from using a well-designed framework stem from a lack of understanding its design or from not having enough creative foresight to know how to use it effectively. At this point, I seriously have to ask you if this framework suites what you're trying to do.

    Honestly, not every website will benefit form a framework. You have to realize this. Don't use the framework for more or less than it's intended for.

    One last address: for those that think that using a framework inherently means added complexity, sometimes you're right. However, you must realize that some more complexly designed websites with intricate functionality (to a safe degree) could benefit from using frameworks just as you can benefit from using standard functions for writing quick scripts.

    M.T.

    --
    "Support Bacteria - Its the only culture some people have" - Circa 1985
  19. Slashdot for Self-Promotion?! by GoCats1999 · · Score: 2, Insightful

    I'm disappointed that Slashdot editors are allowing more and more people to use /. simply as a means for self-promotion. Case in point: here we have a posting by Brian Fioca, referencing an article by Brian Fioca, which talks about a framework by Brian Fioca.

    And I wonder why I'm always so surprised that people complain about bias in the media...