/    Sign up×
Community /Pin to ProfileBookmark

Make php functions available to all apps

I was setting up CakePHP yesterday and I passed over something about making the CakePHP libraries available to all applications by copying them to some folder, but I can’t find it in the manual now.

I’m not wanting to necessarily do it with CakePHP, but with my own UDFs. Where do I place these functions? Do I put them in the extensions folder and then enable them in the php.ini? Or do I just have to require() them?

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@svidgenDec 22.2009 — You can auto-include certain libraries with the PHP auto_prepend_file directive. However, it's probably a better practice to either explicitly [B]include()[/B]/[B]require()[/B] files as needed or to use class autoloading.
Copy linkTweet thisAlerts:
@NogDogDec 22.2009 — As far as I know you would just have to require() the relevant files. Where the files are should not matter, other than you might want them in your PHP include_path (or change the include_path setting to point to wherever they are).
Copy linkTweet thisAlerts:
@MindzaiDec 22.2009 — Cake does it by simply defining the location of the cake library as a constant and building include paths using that. As mentioned above the cake core still uses require/include and class autoloading as normal - using a library location constant just allows the core to be shared by many apps.
Copy linkTweet thisAlerts:
@jamesbcox1980authorDec 23.2009 — I see. This makes sense. I didn't realize it was targeted towards other cake apps.
×

Success!

Help @jamesbcox1980 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...