Closed faizanakram99 closed 6 years ago
Without being able to modify the autoload.php path, I wont be able to use php-pm at production
You can always create your own bootstrap and subclass the Symfony one. Otherwise I'd be happy to accept a PR.
I'm also using a custom vendor dir and had to extend the Symfony bootstrap class just for this line. What would be the best way to fix this? Allow it to be configured via an environment variable and fallback to './vendor/autoload.php' if not defined?
Not sure why it's such a big thing to override the bootstrap? Here's a simple example used outside the Symfony world: https://github.com/volkszaehler/volkszaehler.org/blob/master/lib/Server/PPMBootstrapAdapter.php
Well to update the vendor dir in https://github.com/php-pm/php-pm-httpkernel/blob/master/Bootstraps/Symfony.php you need to override the whole getApplication method, which contains almost the entire bootstrap logic. Maybe we should at least create a getVendorDir method that can be overridden individually?
Sounds good- but without making it api in terms of an additional interface?
Any maybe- instead of getVendorDir
- rather autoload
or prepareAutoloader
to do the actual require statements, too?
I was just thinking of adding a protected function getVendorDir() in the Symfony bootstrap class so it can be overridden without changing the entire getApplication(). If people from other frameworks end up wanting it too we could abstract it then.
I don't think we can do the actual require statements outside of getApplication due to scoping issues. Besides in the normal Symfony entry point (https://github.com/symfony/demo/blob/master/public/index.php) they also just straight out require it.
I'll make a PR so we can discuss it there.
Closed via #122
@faizanakram99 you can use the COMPOSER_VENDOR_DIR environment variable now to set the path of the autoload.php
Great, thanks all of you
PHPPM\Bootstraps\Symfony::getApplication()
contains hard-codedautoload.php
path which may not be always correct as we can specify a different vendor dir incomposer.json
file. Also some applications (particularly old ones) may haveautoload.php
in different location like the application I work upon hasautoload.php
at./symfony/app/autoload.php
instead of./app/autoload.php
In my case I was not able to run the application, for now I just modified the source locally to make it work (which would be lost ofcourse when composer update runs)
Would be nice if autoload path is configurable say by specifying vendor dir or symfony app dir in
ppm.json
or maybe by inferring vendor and app fromcomposer.json
and$container->parameter('kernel.root_dir')
respectively. Without being able to modify theautoload.php
path, I wont be able to use php-pm at production