Composer not loading from php include dir |
Hi,
I've discovered that composer is not loading when my vendor directory is in one my php.ini include_paths. On line 173 of system/core/CodeIgniter.php there's the following... PHP Code: elseif (file_exists($composer_autoload)) ...but file_exists only looks in the current directory. Changing it to... PHP Code: elseif (stream_resolve_include_path($composer_autoload)) ...fixes the issue for me. stream_resolve_include_path is available from 5.3.2 and up. What's the minimum version of php supported? I don't see a list of minimum requirements as part of the installation instructions.
Interesting wording using "should". Does that imply it has to be 5.2.4?
Would it be ok to add a pull request like either of the following or are cross-version workarounds frowned upon? PHP Code: if ($composer_autoload === TRUE) or PHP Code: if ($composer_autoload === TRUE) PS, where is the requirements page linked from in the docs? Couldn't see it linked from any of the Instalation instruction pages.
Why do you add vendor directory to include_paths?
I have never done it. I think it is not needed. About docs, see "Basic Info" before "Installation": http://www.codeigniter.com/user_guide/#basic-info
I work at a University and we do a lot of similar developments for departments, research groups, etc. For us, it's easier to have a single vendor directory in an include path rather than duplicating the same set of packages for each individual development.
(06-16-2015, 12:57 PM)gdhnz Wrote: I work at a University and we do a lot of similar developments for departments, research groups, etc. For us, it's easier to have a single vendor directory in an include path rather than duplicating the same set of packages for each individual development. You can set a custom path to $config['composer_autoload']. http://www.codeigniter.com/user_guide/ge...oader.html (06-16-2015, 07:08 PM)kenjis Wrote:(06-16-2015, 12:57 PM)gdhnz Wrote: I work at a University and we do a lot of similar developments for departments, research groups, etc. For us, it's easier to have a single vendor directory in an include path rather than duplicating the same set of packages for each individual development. To use that I'd need to specify a full path as just adding "vendor/autoload.php" fails the file_exists check in CodeIgniter.php. I've just remembered, I can use a production directory in the config directory to override the differences between development and production environments.
What I've done is add the following to my config.
PHP Code: $config['composer_autoload'] = stream_resolve_include_path("vendor/autoload.php"); stream_resolve_include_path returns false if not detected or the full path if it is detected. Should've thought of this in the first place. |
Welcome Guest, Not a member yet? Register Sign In |