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

The Manifest builder and including custom php libraries


Reply

3 Posts   1520 Views

Avatar
dalesaurus

14 August 2009 at 5:37am (Last edited: 14 August 2009 5:39am), Community Member, 283 Posts

I am attempting to add an existing PHP library into my SS install. I know the SS Manifest Builder traverses all folders hunting for php files that live in a directory that doesn't have a _manifest_exclude file in it and are not listed in _exclude.php.

Logic would tell me that I can:

  • 1. Create a library dir: /mysite/lib/
  • 2. Copy my library files into that dir, MyCustomClass.php
  • 3. Rebuild
  • 4. Call MyClassPhp() from anywhere in the php code

However in my controller when I try to instantiate new MyCustomClass() I get: Fatal error: Class 'MyCustomClass' not found in

I perused the mainfest builder files and see that SS has indeed found it an produced a manifest file to include it. Is there a problem that I'm missing? Can I not have an arbitrary sub folder under /mysite/ with php? I don't see anywhere that the includes only work on /top-level/code/?

Avatar
Willr

14 August 2009 at 3:32pm Forum Moderator, 5511 Posts

You should be able to use any folder name - not just code. I know for example the Mollom module stores the 3rd party library in /lib/

Make sure your filename = classname eg if you call your class MyCustomClass then your file must be MyCustomClass.php.

Avatar
dalesaurus

15 August 2009 at 2:24am Community Member, 283 Posts

Man, that is totally it. My first post on this forum ended up being the same thing.

I'm going to go add some comments on the wiki. I know there is a blurb but it isn't stressed very much.

http://doc.silverstripe.com/doku.php?id=manifestbuilder