[TYPO3-mvc] Using external libraries within Extbase Extension
Hauke Stange
hstange at eheundjanneck.de
Wed Aug 3 15:31:41 CEST 2011
On Wed, 2011-08-03 at 13:34 +0200, Hauke Stange wrote:
> Hi there.
>
> I just want to know if there is a preferred way for using external
> libraries within an extension. In my case I have to use some existing
> code which uses some of the PEAR libraries.
>
> Is there a way for putting the files in a certain directory similar to
> the /Service/ or /Utility/ directories?
Ok, my first guess (dirty hack) was wrong. I copied the needed Libraries
to 'EXT:/Resources/Libraries/PEAR/' and included the following lines of
code where needed...
$extensionPath = t3lib_extMgm::extPath('gpqg');
$pearPath = $extensionPath . 'Resources/Libraries/PEAR/';
if (! set_include_path($pearPath . PATH_SEPARATOR . get_include_path()))
{
throw new Exception("What the heck!!!");
}
require_once 'Net/SFTP.php';
$sftp = new Net_SFTP(Sftp::host, Sftp::port);
The Autoloader(s) from Typo3 / Extbase of course failed to load the
'Net_SFTP' class.
Any hints?
Regards,
Hauke
More information about the TYPO3-project-typo3v4mvc
mailing list