Jump to content


Photo

PEAR classes - How many of you use it?


  • Please log in to reply
13 replies to this topic

#1 Koobi

Koobi
  • Staff Alumni
  • Advanced Member
  • 419 posts
  • LocationColombo, Sri Lanka | South Asia

Posted 06 June 2006 - 10:03 PM

How many of you actually use PEAR classes in your projects?

Sometimes I find them a bit bloated...but sometimes time is an issue and at the cost of optimization and they're easy to use so I put on my Vader shorts and use PEAR hehehe

and if you do use PEAR, what do you think you would say is your favourite package apart from PEAR or PEAR-Info?

what about the rest of you?



For those of you who think I'm talking about a fruit: [a href=\"http://pear.php.net/\" target=\"_blank\"]PEAR[/a]

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 07 June 2006 - 03:08 AM

The only part of PEAR I've even come close to using is an Excel spreadsheet class.

What do you use from PEAR?

Info: PHP Manual


#3 jeremywesselman

jeremywesselman
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts
  • LocationIndependence, KY

Posted 07 June 2006 - 08:04 AM

I have used PEAR DB on a couple of projects. It's alright. I use it mostly when separating content from logic. But lately I have been messing around with CakePHP. I think it is really neat how everything works together like it does.

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--]

#4 Koobi

Koobi
  • Staff Alumni
  • Advanced Member
  • 419 posts
  • LocationColombo, Sri Lanka | South Asia

Posted 07 June 2006 - 08:34 AM

ober: i've been using PEAR's QuickForms and I used ITX briefly, I love it's Console class and phpDocumentor is great too for documentation purposes.


jeremywesselman, is CakePHP fast?

#5 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 07 June 2006 - 12:03 PM

Can you describe what ITX is and how you use phpDocumentor??

Info: PHP Manual


#6 Koobi

Koobi
  • Staff Alumni
  • Advanced Member
  • 419 posts
  • LocationColombo, Sri Lanka | South Asia

Posted 07 June 2006 - 01:16 PM

ITX is a templating class. seems to be good. I like how QuickForms seamlessly integrates with Smarty.

frankly i don't like templating engines so much, especially smarty because it seems bulky but sometimes its not my choice :/

[a href=\"http://pear.php.net/manual/en/package.php.phpdocumentor.intro.php\" target=\"_blank\"]phpDocumentor[/a] is amazing. cuts out any documentation i have to work. the only hitch is that you have to use a certain documentation format for your functions so that when you run your source files through phpdocumentor, it can pick out what it needs to document. it's not much of a problem for me because i've created a keybinding in vim to auto generate the necessary documentation format depending on a functions parameters, return values, etc.

if i'm not mistaken, phpdocumentor is what was used to document the PHP Manual...kinda similar to JavaDoc.

it's hard to explain, the best thing to do is to have a look at the site:
[a href=\"http://pear.php.net/manual/en/package.php.phpdocumentor.intro.php\" target=\"_blank\"]http://pear.php.net/manual/en/package.php....entor.intro.php[/a]

#7 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 07 June 2006 - 01:21 PM

Ok... stupid question, I went about enabling PEAR on my company server and I want to install the QuickForm package, but I have no idea what I'm supposed to do with the files. Where do I put them?

Info: PHP Manual


#8 Koobi

Koobi
  • Staff Alumni
  • Advanced Member
  • 419 posts
  • LocationColombo, Sri Lanka | South Asia

Posted 07 June 2006 - 05:53 PM

i forgot to mention that i use PEAR DB too. i actually quite like that class. very nice functions in it and overall, a very nicely constructed class without too many frills.


[!--quoteo(post=380988:date=Jun 7 2006, 07:21 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Jun 7 2006, 07:21 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Ok... stupid question, I went about enabling PEAR on my company server and I want to install the QuickForm package, but I have no idea what I'm supposed to do with the files. Where do I put them?
[/quote]

well PEAR provides an installer. if you can get to a terminal, type:
pear
and it will show you all the options.


this would show you the list of available PEAR packages:
pear list-all




so typically, if i wanted to find the quickforms package, and install it, i would do it in this sequence:
pear search quickform # searches for the package 'quickforms'
pear install HTML_QuickForm # installs HTML_QuickForms which was found from the previous command
pear info HTML_QuickForm

although those commands arent working for me at the moment...i think somethings temporarily wrong at PEAR's end.


and if you want to use quickforms, this is a good start:
[a href=\"http://pear.php.net/manual/en/package.html.html-quickform.tutorial.php\" target=\"_blank\"]http://pear.php.net/manual/en/package.html...rm.tutorial.php[/a]

once you're done installing PEAR, depending on if you've edited any config variables, PEAR will be installed to that directory. by default this is generally /usr/share/php or /usr/share/pear (it's stored in php.ini under the include_path directive)

nice system. only thing is i think some classes are a bit too heavy but i really like the DB class...especially since i'm not too fond of handling db related issues via PHP. you should also look at the Console package for PEAR...the member functions are really nicely constructed and thought through.


let me know if i can be of more help on this subject.

#9 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 07 June 2006 - 07:27 PM

Pardon me because I'm probably missing something very simple... but is it going to find the quickform package on the harddrive by default... or do I have to put it in a specific place? And do I leave it zipped up or do I extract it down to the folder + package.xml file?

Info: PHP Manual


#10 Koobi

Koobi
  • Staff Alumni
  • Advanced Member
  • 419 posts
  • LocationColombo, Sri Lanka | South Asia

Posted 07 June 2006 - 08:35 PM

[!--quoteo(post=381114:date=Jun 8 2006, 01:27 AM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Jun 8 2006, 01:27 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Pardon me because I'm probably missing something very simple... but is it going to find the quickform package on the harddrive by default... or do I have to put it in a specific place? And do I leave it zipped up or do I extract it down to the folder + package.xml file?
[/quote]


i believe what you're trying to do is manually install it.
it's better to use the built in PEAR installer. if you're on an up to date PHP installation, you probably have the PEAR base installer unless you compiled PHP with the --without-pear flag.

if you're on *nix, you can install the PEAR base installer via your repository. I know debian/ubuntu/gentoo/freeBSD repositories have it. simply search for "PEAR" in your repositories and install PEAR and PEAR-info because those are dependencies for any PEAR class as all the other classes inherit things such as error handling from them. and once you have pear, you can use it via CLI as i've posted above.

if you're on a Win machine and you dont have PEAR, i suppose you could follow these instructions here: [a href=\"http://pear.php.net/manual/en/installation.getting.php\" target=\"_blank\"]http://pear.php.net/manual/en/installation.getting.php[/a]

either way, once you have PEAR installed, simply use the commands i've mentioned above to install and in general, manage any PEAR classes because it handles dependencies to an extent.



what really happens is, it downloads and copies the packages you request to a folder that is determined in the PEAR configs which in turn was determined by PHP's settings. this path to the PEAR files is appended to php.ini if i'm not mistaken (either that or PEAR only copies these files to a path that exists in php.ini) and this path is defined in the include_path directive of php.ini

so everytime you want to include a PEAR class, you don't give the absolute path to it, you simply include it relative to include_path and it will be included in your system.

perhaps this link will help as well:
[a href=\"http://pear.php.net/manual/en/installation.cli.php\" target=\"_blank\"]http://pear.php.net/manual/en/installation.cli.php[/a]


if i have not answered your question then i don't think i understand the question. as i see it, you're trying to install the packages manually which can be messy unless you know a few configuration variables and the PEAR folder structure. just use the base installer and you should be good to go.


let me know if i need to further clarify anything. you should really try some of the PEAR classes, SOME of them look pretty sweet.

#11 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 08 June 2006 - 12:02 PM

Ok, thanks. I'm just not sure if the webserver I'm using has internet access (it's an internal server). Although when I went through the process of installing it the other day (the included package), it did appear to download some stuff... sooo... ? I'll give it a shot. Thanks!

Info: PHP Manual


#12 Koobi

Koobi
  • Staff Alumni
  • Advanced Member
  • 419 posts
  • LocationColombo, Sri Lanka | South Asia

Posted 08 June 2006 - 01:55 PM

well let me know how it goes.

i have a rough idea of the PEAR directory structure, so worse comes to worse, i can give you a hand with that.

but if you would find it helpful, here is what my PEAR directory looks like:
koobi@ubuntu:~/Desktop$ ls -lh /usr/share/php
total 232K
drwxr-xr-x   2 root root 4.0K 2006-05-15 02:55 Archive
drwxr-xr-x   4 root root 4.0K 2006-05-30 01:59 Auth
-rw-r--r--   1 root root  30K 2006-05-30 01:59 Auth.php
drwxr-xr-x   2 root root 4.0K 2006-05-15 02:55 Console
drwxr-xr-x   3 root root 4.0K 2006-05-15 02:55 data
drwxr-xr-x   2 root root 4.0K 2006-05-18 08:18 DB
-rw-r--r--   1 root root  39K 2006-05-18 08:18 DB.php
drwxr-xr-x  10 root root 4.0K 2006-05-30 01:59 docs
drwxr-xr-x   4 root root 4.0K 2006-05-18 08:19 HTML
-rw-r--r--   1 root root  13K 2005-09-02 20:12 HTTP.php
drwxr-xr-x   2 root root 4.0K 2006-05-15 02:55 Mail
-rw-r--r--   1 root root 7.9K 2005-09-02 20:12 Mail.php
drwxr-xr-x   3 root root 4.0K 2006-05-15 02:55 Net
drwxr-xr-x   2 root root 4.0K 2006-05-15 02:55 OS
drwxr-xr-x   4 root root 4.0K 2006-05-15 02:55 PEAR
-rw-r--r--   1 root root  10K 2006-03-08 14:18 pearcmd.php
-rw-r--r--   1 root root  33K 2006-03-08 14:18 PEAR.php
drwxr-xr-x   5 root root 4.0K 2006-05-19 22:14 PhpDocumentor
drwxr-xr-x   3 root root 4.0K 2006-04-12 23:48 PHPUnit
-rw-r--r--   1 root root 2.5K 2004-11-06 14:37 PHPUnit.php
drwxr-xr-x   3 root root 4.0K 2006-05-25 11:49 smarty
-rw-r--r--   1 root root  18K 2006-03-08 14:18 System.php
drwxr-xr-x   8 root root 4.0K 2006-05-30 01:59 tests
drwxr-xr-x   4 root root 4.0K 2006-05-15 02:55 XML


so i have the PEAR directory which holds all the PEAR base files. it is a dependency for every other PEAR package so you need it. and i have a bunch of directories like DB, Archive, Auth which are all packages simply unzipped to that directory. PEAR installer does this internally. i'm not sure how PEAR registers these paths so that it can keep track. i suppose it has these paths hardcoded into it.


but how do i know what my PEAR directory is to even post my structure to you in the first place? i do the following in terminal:
koobi@ubuntu:~/Desktop$ pear config-get php_dir

and in my case, the result was /usr/share/php but it can vary depending on your configs.

#13 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 08 June 2006 - 02:09 PM

I may have to play with this on my home server. I'm goofing around with this on a server at work right now but I'm leaving this company in 1 week so I don't want to screw up anything before I head out ;-)

Info: PHP Manual


#14 jeremywesselman

jeremywesselman
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts
  • LocationIndependence, KY

Posted 09 June 2006 - 04:20 AM

CakePHP is as fast as I need it to be. I haven't really put a large load on it yet. I have just been messing around with it a little. It is very fast to develop with. They built in it on the Ruby on Rails concept, except using PHP. It is very easy to get an application up and running quickly.

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users