NYCPHP Meetup

NYPHP.org

[nycphp-talk] include_path usage with PayPalPro SDK???

Jon Baer jonbaer at jonbaer.com
Sun Jul 30 12:59:27 EDT 2006


Normally w/ needed packages like those which don't follow the PEAR  
method is that I split it up and make it into a PEAR-like package  
(without the meta) ... for example for Cake I have:

/usr/lib/php/Cake.php
/usr/lib/php/Cake/all/the/other/crap.php
...

Then anytime its need I have one include path and just require 
('Cake.php');

You would basically fill up that file w/ all your are going to need.   
I beleive its more portable to do it this way but Ive heard of alot  
of people being very anti-pear which I still don't understand.  Ive  
switch to using Cake's /vendor path and placing any PEAR packages I  
need in there and bootstrapping that path via set_include_path 
(get_include_path() . ':/my/new/path')

I wish the include_path did have @ least some namespacing ability to  
it though, then your probably would be solve in saying something like  
use('PayPal') which is what the Cake framework does.

- Jon

On Jul 29, 2006, at 5:04 PM, Bob Mariotti wrote:

> Fellow PHP'ers;
>
> I've been developing with PHP for several years now with reasonable
> success.  Recently I'm trying to integrate PayPal's supplied SDK  
> into an
> eCommerce app and I am having trouble with finding their own included
> modules.
>
> I've tried studying the logic and use of the php.ini directive
> "include_path" and the only definition that seems to work is if I  
> define
> the FULL path of every directory individually which makes for a very
> long, long path string.
>
> For reference I have my includes directory outside of the document
> root(s) in something similar to /srv/www/sites/inc and for everything
> else this seems to work just fine.   Now PayPal's supplied tree is a
> continuation in this same directory and it itself includes nested
> directories so their top level would be at /srv/www/sites/inc/ 
> PayPal and
> then on down.
>
> Again, if I define each and every lower directory individually in the
> path, things appear to work.  Otherwise, it finds nothing of PayPal.
> Oh, and further information, PayPal uses multiple nested includes  
> within
> its supplied modules (whew!).
>
> For some strange reason I thought that the include_path would be
> recursive but I guess not.
>
> Someone in this group must have worked with the PayPal module(s)  
> before
> and must have come up against the same situation.
>
> Therefore, could someone in the know PLEASE explain how they overcame
> this situation or can someone at least advise how to best handle the
> definitions to accommodate this?
>
> Thanks all.
>
> Bob
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
>




More information about the talk mailing list