Defining custom “vendors” folders

Published on and tagged with cakephp  configuration

CakePHP comes by default with two “vendors” folders for third-party libraries: one is in the root folder of the cake distribution (for libraries used by multiple applications), and the other is in the “app” folder (for application-specific libraries).

Thanks to changeset 6414 it is now possible to define additional “vendors” folders in app/config/bootstrap.php:

$vendorPaths = array('<path to additional vendors folder>');

If you want to use a file from such an alternative “vendors” folder you have to include it with

App::import('vendor', '<filename without PHP file extension>');

The traditional way — using the vendor() function — doesn’t work yet has been deprecated according to comments in tickets.

2 comments baked

  • yunhaihuang

    in cakephp, how to use the folder helper? would you mind giving an example to explane it?

  • cakebaker

    @yunhaihuang: What do you mean with “folder helper”? The class “Folder” in cake/libs/folder.php? Its usage is quite simple:

    App::import('Core', 'Folder');
    $folder = new Folder('/home/somefolder');

    Hope that helps!

Bake a comment




(for code please use <code>...</code> [no escaping necessary])

© daniel hofstetter. Licensed under a Creative Commons License