tags:

views:

743

answers:

2

I have a directory of PHP scripts ( mainly utilities), that is located on C:\Development, whereas my Symfony application is located in D:\Development.

How to include the utility scripts into the Symfony application? I try not to use include() because I prefer a symfony-like command.

+1  A: 

There are basically two approaches

  1. Extend the autoloading
  2. modify the include path

#2 can be achieved numerous ways. If you are unsure how to, let me know and I'll post some details.

You don't have to change php.ini. You can use ini_set or set_include_path. Check ricardo's comment in the User Contributed Notes section at the documentation for set_include_path().

Peter Bailey
Modify the include path.. are you saying that I have to change the PHP.ini file? I don't prefer that; instead, I would like do the referencing inside my Symfony application
Ngu Soon Hui
I modified my answer to address your comment
Peter Bailey
+1 The autoload extension is the way to do it whilst staying within Symfony.
Colonel Sponsz
+1  A: 

Personally, I'd create a new folder inside the lib/vendor folder on your project, put your scripts in there, and then symfony should handle it all automatically assuming you've followed its naming conventions for files/classes. If not, you may need to alter the autoload stuff as per Peter Bailey's answer.

I prefer this way because I like to be able to deploy the project from one server to another as one atomic unit with no reliance on external dependancies. This may not be an issue for you though, in which case the existing answer will suit you better.

benlumley