I'm making a request handler for php, which will route requests to specific files on the server. I have a .htaccess
file that routes every request to DOCUMENT_ROOT/Server/handleRequest.php
, which then handles everything else from there. To make this work, I copy the .htaccess
file and Server
folder to the root folder for my site.
I've been successful in getting composer to install my project to the vendor directory under vendor/JakarCo/PHP-Request-Handler
. I would like all the files (at the very least, the .htaccess
file) to be installed directly into the site's document root folder (one level above the vendor folder).
I am trying to use oomphinc/composer-installers-extender
to set a custom path, and it's not working, and I can't figure out how to fix it.
The composer.json
in the request handler is
{
"name": "JakarCo/PHP-Request-Handler",
"description": "php request handler",
"type": "library",
"license": "proprietary",
"require": {
"php": "^5.3.6 || ^7.0",
"oomphinc/composer-installers-extender": "@dev"
},
"extra": {
"installer-types": ["library"],
"installer-paths": {
"my/path/": ["JakarCo/PHP-Request-Handler/"],
"path/to/libraries/JakarCo/": ["type:library"]
}
}
}
The composer.json
for the project that is including the request handler is:
{
"repositories": [
{
"url": "https://github.com/JakarCo/PHP-Request-Handler",
"type": "vcs"
}
],
"require": {
"JakarCo/PHP-Request-Handler": "dev-master"
}
}
When I run composer update
from from the site's root folder, it runs successfully (now with nothing to change). So I deleted the vendor folder and the composer.lock file and ran composer install
and had three successful installs, of composer/installer, the oomphinc one, and mine. But mine is still going into the vendor/JakarCo/PHP-Request-Handler
, when the Server
folder and .htaccess
files need to go into the site's root folder.
I suspect my problem is with installer-paths
, but I can't figure out how it's supposed to be. Also, I'm probably not supposed to use @dev
for the oomphinc version, but I don't know what else to put.
I'm experienced with PHP, but very out of practice, and am new to using composer and git.