SitePoint Sponsor

User Tag List

Results 1 to 11 of 11

Thread: PEAR & PECL

Hybrid View

  1. #1
    SitePoint Zealot loupblanc's Avatar
    Join Date
    Nov 2004
    Location
    Edinburgh
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PEAR & PECL

    Hi folks,

    Right I'll take the risk to sound like a complete idiot but I just learnt about PECL and I was wondering what the difference between that and PEAR was.

    I'm guessing one is a repository of extentions while the other is a repository of modules but that doesn't tell me what the difference actually is.

    Thanks for clearing a confused mind

    -Jean-Loup

  2. #2
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's about right. PEAR modules are written in PHP while PECL extentions are written in C.

  3. #3
    SitePoint Addict Quaint's Avatar
    Join Date
    May 2004
    Location
    Netherlands
    Posts
    219
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by loupblanc
    I'm guessing one is a repository of extentions while the other is a repository of modules but that doesn't tell me what the difference actually is.
    Extensions and modules are the same, basically... Just a different word (correct me if I'm wrong)...

    As HardCoded said: PEAR is written in PHP, PECL in C, that's the most basic way to explain the difference...

    You can use PEAR on any server and just load the PEAR PHP code into your own and use it. PECL however is something that HAS to be installed on the server (and activated) in order for you to use it. PECL adds new PHP FUNCTIONS (it extends PHP in a way..) while PEAR adds ready-to-use code that YOU can use to quickly handle common problems (so you won't have to reinvent the wheel).

    I'd say it's WELL WORTH your time diving into, (PEAR that is) as it's really brilliantly written code that allows you to handle common stuff so much quicker! I would only really look into PECL once you encounter really specific trouble (like wanting to add the possibility to PHP5 to create PDF documents) (wrong example, can be done differently (using PHP code) but than again, it's just an example)

  4. #4
    SitePoint Zealot loupblanc's Avatar
    Join Date
    Nov 2004
    Location
    Edinburgh
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see, does that mean you have to recompile the PHP source code when you add a PECL extention? And then what? Do they work in the same way as a PHP function like, I dunno, xml_parse() works? ( Note: I don't know if such a function exists, I'm just giving an example )

    Just curious

    Cheers

    -Jean-Loup

  5. #5
    SitePoint Addict Quaint's Avatar
    Join Date
    May 2004
    Location
    Netherlands
    Posts
    219
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes you have to recompile PHP (with the extension), and yes they add functions to PHP. By the way, on Windows servers, you only have to place the DLL file in the correct folder, and mention the DLL in your PHP.ini (and possibly restart Apache) and it will work aswell...

    Just curious, what functionality do you seek?

  6. #6
    SitePoint Zealot loupblanc's Avatar
    Join Date
    Nov 2004
    Location
    Edinburgh
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Quaint
    Just curious, what functionality do you seek?
    Apart from SVG, which, like I just said, I've worked out on my own somehow, I was just really curious about PECL since I'd never heard of it before.

    Cheers

    -Jean-Loup

  7. #7
    SitePoint Zealot loupblanc's Avatar
    Join Date
    Nov 2004
    Location
    Edinburgh
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quaint, thanks that's a lot clearer now.

    I'd use PEAR more, except the only modules that are interesting to me right now (SVG) are so poorly documented (unless it changed recently) that I pretty much had to use my own code.

    I do intend to check out PEAR for further projects though

    Cheers

    -Jean-Loup

    PS: Sorry this is a very bad joke that must have been done a zillion times but doesn't anyone worry if their PHP code goes PEAR shaped?... *I'll get my coat now*

  8. #8
    SitePoint Addict Quaint's Avatar
    Join Date
    May 2004
    Location
    Netherlands
    Posts
    219
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by loupblanc
    PS: Sorry this is a very bad joke that must have been done a zillion times but doesn't anyone worry if their PHP code goes PEAR shaped?... *I'll get my coat now*
    Don't think so...


    PEAR definitely is worth checking out at the start of EVERY project. Auth class for example works great in any situation, just for session handling itself it's brilliant...

  9. #9
    SitePoint Zealot loupblanc's Avatar
    Join Date
    Nov 2004
    Location
    Edinburgh
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Quaint
    PEAR definitely is worth checking out at the start of EVERY project.
    I did when I started this project but like I said, I was really put off by the lack of documentation and I don't see the point of using something that doesn't come with instructions on how to use it. It migth be simple enough that it doesn't require documentation but I find it good practice, especially if you're going to share code.

    Cheers

    -Jean-Loup

  10. #10
    SitePoint Addict Quaint's Avatar
    Join Date
    May 2004
    Location
    Netherlands
    Posts
    219
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Indeed, the documention is quite poor, but with a little google I came up with:

    http://www.svgopen.org/2004/papers/ServerSideSurvey/#S3
    http://circle.ch/php/

    and lot's more..

    Bear in mind that you can use the sample code (test files) and API documention and a little effort to get to understand PEAR...

    http://pear.php.net/package/XML_SVG/docs/0.0.3/ (API docs)

    A lot of PEAR classes are not yet full releases, the SVG class is actually at release 0.03, which means that the code might be working, but the documentation has not been written (possibly because the code might change in future versions, or more likely because it is not YET the main point of interest for the coder)...

    Really, sample files + API documention + a look at the actual source code get's me to where I want to go...

  11. #11
    SitePoint Zealot loupblanc's Avatar
    Join Date
    Nov 2004
    Location
    Edinburgh
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For for my redemption, at least developping my own classes has given me a greater understanding of OO PHP and therefore will help me make better use of other PEAR modules in the future. Gotta learn somehow

    Thanks for those links, I've seen them before (except the circle.ch one) and couldn't get much out of them

    Cheers

    -Jean-Loup


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •