php should I use pear?

Posted on 2009-05-02
Last Modified: 2013-12-12
I have a php site that I am going to be totally re-writing soon.  It currently is not object oriented in any way, and I want to start using classes.  I wrote most of it a long time ago, when I don't really think php had classes, or at least, I didn't know about them.

Anyway, I will be using mysql forever and plan to use a db class anyway, so if I ever want to switch my db, I am not worried about re-writing one class.  So the ability to switch db's is of no use to me.

Should I use pear?  I am worried about having to install a bunch of stuff on my servers (I have one template site that I deploy to a ton of different sites all the time.  I could potentially switch hosting companies in the future, and want this as light as possible.)

Question by:jackjohnson44
    1 Comment
    LVL 5

    Accepted Solution


    Packing PEAR with your product is not hard, the only thing you have to do is to copy the pear directory (with only the extensions your are using) to your site. These files can take as much as 4mb (it is a bunch of files)(but you can keep it low if you want by not  putting the stuff  you dont use) so its good to have that thing in mind. I for one use PEAR MDB2 and PEAR HTML_Template_IT (and sometimes the DataObject) all the time. I would say you should use html_tempalte_it for your templates and MDB2 for the db connection or DataObjects if you want to have objects that represent each table. Use ini_set("include_path", "./path_to_YOUR_local_pear/") to make the includes locally in your project.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    The viewer will learn how to count occurrences of each item in an array.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now