PEAR classes - How many of you use it?
Posted 06 June 2006 - 10:03 PM
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]
Posted 07 June 2006 - 08:04 AM
Posted 07 June 2006 - 08:34 AM
jeremywesselman, is CakePHP fast?
Posted 07 June 2006 - 01:16 PM
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]
Posted 07 June 2006 - 05:53 PM
[!--quoteo(post=380988:date=Jun 7 2006, 07:21 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Jun 7 2006, 07:21 PM) [/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?
well PEAR provides an installer. if you can get to a terminal, type:
pearand it will show you all the options.
this would show you the list of available PEAR packages:
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.
Posted 07 June 2006 - 07:27 PM
Posted 07 June 2006 - 08:35 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?
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.
Posted 08 June 2006 - 12:02 PM
Posted 08 June 2006 - 01:55 PM
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.
Posted 09 June 2006 - 04:20 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users