Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Integrating Zend classes to Silverstripe


Reply

5 Posts   648 Views

Avatar
ville

16 July 2012 at 6:34am Community Member, 5 Posts

Hello,

I'm would like to know how to integrate Zend libraries to Silverstripe? I would appreciate if somebody has a proper example.

Best regards.

Avatar
Willr

16 July 2012 at 7:29pm Forum Moderator, 5511 Posts

Normally you can just put the libraries in a folder (our standard is to use thirdparty) and use a require() call. Several modules (including the core framework) include thirdparty (and specifically Zend) classes like this

A couple examples:

SS Config - https://github.com/silverstripe/sapphire/blob/master/core/manifest/ConfigManifest.php#L179
Twitter module - http://svn.rentbox.co.nz/public/twitter/trunk/

Avatar
ville

17 July 2012 at 9:17pm Community Member, 5 Posts

Thanks!

btw. where is "the right place" to globally include the Zend Framework into SilverStripe? Embedding just in a controller file?

Avatar
martimiz

18 July 2012 at 4:39am Forum Moderator, 1091 Posts

For the frontend, the Page_Controller init() function is one of those places...

Avatar
Willr

18 July 2012 at 5:35pm (Last edited: 18 July 2012 5:36pm), Forum Moderator, 5511 Posts

You should include it when you need it. If you only need it for 1 small function, include it in that function, otherwise you can include it in your _config.php file (so it's available early on) the issue with init() is that it is only called as part of the controller request process for *that* controller.