Share helpers and components between projects

Published on and tagged with cakephp  component  configuration  helper

If you have several projects you probably have helpers and/or components you use in more than one project. Up to now I handled this situation in the following way: I had a special project which contained all the helpers and components I wanted to use in several projects. If I needed a helper or component in a project, I copied it from there to my project. This approach works, but it is a bit cumbersome if you have to update a helper or component ;-)

But there is a better solution as Nate has shown in the google group. You can define additional helper and component paths in app/config/bootstrap.php. Here an example:

$componentPaths = array('/path_to_my_shared_components/');
$helperPaths = array('/path_to_my_shared_helpers/');

With that, CakePHP not only looks in the default places for helpers and components, but also in the paths defined in app/config/bootstrap.php.

Bake a comment




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

© daniel hofstetter. Licensed under a Creative Commons License